From ec6efdcb6cb30bd23fb53c5afb68ff29e6f3d45c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 10 Mar 2014 16:57:50 +0000 Subject: [PATCH 03/23] TpContact: mime_file_written: don't leak the file's path --- telepathy-glib/contact.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c index 95665e7..f59bd75 100644 --- a/telepathy-glib/contact.c +++ b/telepathy-glib/contact.c @@ -2054,21 +2054,23 @@ mime_file_written (GObject *source_object, WriteAvatarData *avatar_data = user_data; GFile *file = G_FILE (source_object); TpContact *self; + gchar *path = g_file_get_path (file); g_assert (file == avatar_data->mime_file); if (!g_file_replace_contents_finish (file, res, NULL, &error)) { - DEBUG ("Failed to store MIME type in cache (%s): %s", - g_file_get_path (file), error->message); + DEBUG ("Failed to store MIME type in cache (%s): %s", path, + error->message); g_clear_error (&error); } else { - DEBUG ("Contact avatar MIME type stored in cache: %s", - g_file_get_path (file)); + DEBUG ("Contact avatar MIME type stored in cache: %s", path); } + g_free (path); + self = g_weak_ref_get (&avatar_data->contact); if (self == NULL) -- 1.9.0