[nautilus/wip/antoniof/meets-valgrind: 8/11] tag-manager: Don't leak stamp path string
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/meets-valgrind: 8/11] tag-manager: Don't leak stamp path string
- Date: Mon, 21 Dec 2020 18:35:05 +0000 (UTC)
commit b6d35d1e9c8aaa0dd3a4f282c7023faf69b5522b
Author: António Fernandes <antoniof gnome org>
Date: Sat Dec 19 13:14:24 2020 +0000
tag-manager: Don't leak stamp path string
Also respect code style (return type in different line).
src/nautilus-tag-manager.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c
index b3e79cdeb..e43078a2b 100644
--- a/src/nautilus-tag-manager.c
+++ b/src/nautilus-tag-manager.c
@@ -88,7 +88,8 @@ 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);
}
@@ -866,7 +867,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);
@@ -1013,7 +1014,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]