[gnome-initial-setup] account: Fix a minor memory leak of an avatar path



commit e5e90d08cac210422794d677970cd5c8833c0295
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Feb 6 13:36:42 2020 +0000

    account: Fix a minor memory leak of an avatar path
    
    `g_file_get_path()` returns a newly allocated string.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gnome-initial-setup/pages/account/um-photo-dialog.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/um-photo-dialog.c 
b/gnome-initial-setup/pages/account/um-photo-dialog.c
index 9e87f0b..b61c2aa 100644
--- a/gnome-initial-setup/pages/account/um-photo-dialog.c
+++ b/gnome-initial-setup/pages/account/um-photo-dialog.c
@@ -192,8 +192,9 @@ create_face_widget (gpointer item,
 {
         GdkPixbuf *pixbuf = NULL;
         GtkWidget *image;
+        g_autofree gchar *path = g_file_get_path (G_FILE (item));
 
-        pixbuf = gdk_pixbuf_new_from_file_at_size (g_file_get_path (G_FILE (item)),
+        pixbuf = gdk_pixbuf_new_from_file_at_size (path,
                                                    AVATAR_PIXEL_SIZE,
                                                    AVATAR_PIXEL_SIZE,
                                                    NULL);
@@ -207,7 +208,7 @@ create_face_widget (gpointer item,
         gtk_widget_show (image);
 
         g_object_set_data_full (G_OBJECT (image),
-                                "filename", g_file_get_path (G_FILE (item)),
+                                "filename", g_steal_pointer (&path),
                                 (GDestroyNotify) g_free);
 
         return image;


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