[tracker/wip/carlosg/libtracker-data-fixes: 2/3] libtracker-data: Honor out variable in early return path
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/libtracker-data-fixes: 2/3] libtracker-data: Honor out variable in early return path
- Date: Thu, 23 Dec 2021 23:09:36 +0000 (UTC)
commit e53487d484044051ff41c81f9e04ca6836e7a413
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Dec 23 18:25:50 2021 +0100
libtracker-data: Honor out variable in early return path
When handling the insertion of an individual TrackerResource property that
points to another TrackerResource, we check if the latter resource is
already inserted/known and return early in update_resource_single(), but
we forget to set the "id" out variable, thus go with an uninitialized
value here.
Shuffle the early return, so the resource ID is already known, and correctly
returned.
src/libtracker-data/tracker-data-update.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index d0b68edce..91807f165 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -3130,20 +3130,13 @@ update_resource_single (TrackerData *data,
gint64 *id,
GError **error)
{
- GList *properties, *l;
+ GList *properties = NULL, *l;
GError *inner_error = NULL;
const gchar *subject_str;
gint64 subject;
gchar *graph_uri = NULL;
gboolean is_bnode = FALSE;
- if (g_hash_table_lookup (visited, resource))
- return TRUE;
-
- g_hash_table_add (visited, resource);
-
- properties = tracker_resource_get_properties (resource);
-
subject_str = tracker_resource_get_identifier (resource);
if (!subject_str || g_str_has_prefix (subject_str, "_:")) {
is_bnode = TRUE;
@@ -3156,6 +3149,13 @@ update_resource_single (TrackerData *data,
return FALSE;
}
+ if (g_hash_table_lookup (visited, resource))
+ goto out;
+
+ g_hash_table_add (visited, resource);
+
+ properties = tracker_resource_get_properties (resource);
+
if (graph) {
tracker_data_manager_expand_prefix (data->manager,
graph, NULL, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]