[nautilus/wip/antoniof/template-leaks: 4/6] tag-manager: Don't leak stamp path string




commit de4573272f5d7619bf3472a7ef4e9a183abe72b1
Author: António Fernandes <antoniof gnome org>
Date:   Sat Dec 19 13:14:24 2020 +0000

    tag-manager: Don't leak stamp path string
    
    Leak found in valgring file provided by nekohayo

 src/nautilus-tag-manager.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c
index 24c2de616..c85a735d9 100644
--- a/src/nautilus-tag-manager.c
+++ b/src/nautilus-tag-manager.c
@@ -88,7 +88,7 @@ static guint signals[LAST_SIGNAL];
 /* Limit to 10MB output from Tracker -- surely, nobody has over a million starred files. */
 #define TRACKER2_MAX_IMPORT_BYTES 10 * 1024 * 1024
 
-static const gchar *tracker2_migration_stamp (void)
+static gchar *tracker2_migration_stamp (void)
 {
     return g_build_filename (g_get_user_data_dir (), "nautilus", "tracker2-migration-complete", NULL);
 }
@@ -857,7 +857,7 @@ process_tracker2_data_cb (GObject      *source_object,
                           gpointer      user_data)
 {
     NautilusTagManager *self = NAUTILUS_TAG_MANAGER (source_object);
-    const gchar *path = tracker2_migration_stamp ();
+    g_autofree gchar *path = tracker2_migration_stamp ();
     g_autoptr (GError) error = NULL;
 
     tracker_sparql_connection_update_finish (self->db, res, &error);
@@ -1004,7 +1004,9 @@ export_tracker2_data (NautilusTagManager *self)
 void
 nautilus_tag_manager_maybe_migrate_tracker2_data (NautilusTagManager *self)
 {
-    if (g_file_test (tracker2_migration_stamp (), G_FILE_TEST_EXISTS))
+    g_autofree gchar *path = tracker2_migration_stamp ();
+
+    if (g_file_test (path, G_FILE_TEST_EXISTS))
     {
         DEBUG ("Tracker 2 migration: already completed.");
     }


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