[tracker] rasqal: Fix crash with multiple updates in a single query



commit 2e067d6bd2b0519f5beeb24d7654fa0ce5740504
Author: Jürg Billeter <j bitron ch>
Date:   Thu Apr 30 10:55:19 2009 +0200

    rasqal: Fix crash with multiple updates in a single query
---
 src/rasqal/rasqal_query.c  |    5 ++++-
 src/rasqal/sparql_parser.y |    1 -
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/rasqal/rasqal_query.c b/src/rasqal/rasqal_query.c
index dcc709a..77ef274 100644
--- a/src/rasqal/rasqal_query.c
+++ b/src/rasqal/rasqal_query.c
@@ -190,8 +190,11 @@ rasqal_free_query(rasqal_query* query)
   if(--query->usage)
     return;
 
-  if (query->next)
+  if (query->next) {
+    /* avoid double free of context */
+    query->next->context = NULL;
     rasqal_free_query (query->next);
+  }
 
   if(query->factory)
     query->factory->terminate(query);
diff --git a/src/rasqal/sparql_parser.y b/src/rasqal/sparql_parser.y
index adb1ff2..b3d600b 100644
--- a/src/rasqal/sparql_parser.y
+++ b/src/rasqal/sparql_parser.y
@@ -401,7 +401,6 @@ Update: UpdateQuery
   query->next->generate_bnodeid_handler = query->generate_bnodeid_handler;
 
   query->next->context = query->context;
-  query->context = NULL;
 
   rq = query->next;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]