[tracker/wip/carlosg/fix-blank-node-labels] libtracker-data: Fix (again) blank node lifetime handling
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/fix-blank-node-labels] libtracker-data: Fix (again) blank node lifetime handling
- Date: Mon, 18 May 2020 19:47:51 +0000 (UTC)
commit 9fa1fc121c523d5b2a92f9ed859fff85d80a952b
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 18 21:43:21 2020 +0200
libtracker-data: Fix (again) blank node lifetime handling
Commit a6013fe3d92 sloppily tried to fix blank node lifetimes.
However I missed that the Update rule is defined in a recursive
manner, so this in essence resulted on the hashtable still being
created before each individual update, but also leaked and
overwritten.
Move the hashtable creation/destruction so it truly stays alive
for the full parsing stage.
src/libtracker-data/tracker-sparql.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 130a7072d..5bcc87b9f 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -194,6 +194,8 @@ tracker_sparql_finalize (GObject *object)
tracker_token_unset (&sparql->current_state.subject);
tracker_token_unset (&sparql->current_state.predicate);
tracker_token_unset (&sparql->current_state.object);
+ g_clear_pointer (&sparql->current_state.blank_node_map,
+ g_hash_table_unref);
g_clear_pointer (&sparql->current_state.union_views, g_hash_table_unref);
g_clear_pointer (&sparql->current_state.construct_query,
tracker_string_builder_free);
@@ -2320,8 +2322,11 @@ translate_Update (TrackerSparql *sparql,
*/
_call_rule (sparql, NAMED_RULE_Prologue, error);
- sparql->current_state.blank_node_map =
- g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ if (!sparql->current_state.blank_node_map) {
+ sparql->current_state.blank_node_map =
+ g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_free);
+ }
if (_check_in_rule (sparql, NAMED_RULE_Update1)) {
if (sparql->blank_nodes)
@@ -2338,9 +2343,6 @@ translate_Update (TrackerSparql *sparql,
_call_rule (sparql, NAMED_RULE_Update, error);
}
- g_clear_pointer (&sparql->current_state.blank_node_map,
- g_hash_table_unref);
-
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]