[tracker/wip/carlosg/plug-leaks: 2/5] libtracker-data: Plug leak




commit 473ef244731b80b787d00e21963c79f82d061de4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 20 21:05:00 2020 +0100

    libtracker-data: Plug leak
    
    The tracker_data_manager_expand_prefix() function will transfer allocated
    memory back despite the return value. Just use that on all paths.

 src/libtracker-data/tracker-data-update.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 2f461f4dc..06f3a441a 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1625,13 +1625,12 @@ bytes_from_gvalue (GValue       *gvalue,
                        }
 
                        *bytes = g_bytes_new (bnode, strlen (bnode) + 1);
-               } else if (tracker_data_manager_expand_prefix (data->manager,
-                                                              g_value_get_string (gvalue),
-                                                              NULL, NULL,
-                                                              &expanded)) {
-                       *bytes = g_bytes_new_take (expanded, strlen (expanded) + 1);
                } else {
-                       *bytes = g_bytes_new (uri, strlen (uri) + 1);
+                       tracker_data_manager_expand_prefix (data->manager,
+                                                           g_value_get_string (gvalue),
+                                                           NULL, NULL,
+                                                           &expanded);
+                       *bytes = g_bytes_new_take (expanded, strlen (expanded) + 1);
                }
        } else if (G_VALUE_HOLDS_STRING (gvalue)) {
                const gchar *ptr;


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