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




commit 32349ef7a5bb7efa8ce84ba75026d318fba093b8
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Dec 20 21:04:02 2020 +0100

    libtracker-data: Plug leak
    
    The "ns" variable was being leaked in some circumstances, ensure
    it's freed properly on all paths.

 src/libtracker-data/tracker-data-manager.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 4a2bee58d..23291722d 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -5097,18 +5097,19 @@ tracker_data_manager_expand_prefix (TrackerDataManager  *manager,
                        expanded_ns = tracker_namespace_get_uri (namespaces[i]);
 
                        if (prefix_map)
-                               g_hash_table_insert (prefix_map, ns, g_strdup (expanded_ns));
+                               g_hash_table_insert (prefix_map, g_strdup (ns), g_strdup (expanded_ns));
                        break;
                }
        }
 
+       g_free (ns);
+
        if (!expanded_ns) {
                if (prefix)
                        *prefix = NULL;
                if (expanded)
                        *expanded = g_strdup (term);
 
-               g_free (ns);
                return FALSE;
        }
 


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