[libadwaita] demo-window: Fix a memory leak



commit 2c81acd1971e92fde0f6587305dcff9d15081dad
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Tue Jul 20 17:28:59 2021 +0530

    demo-window: Fix a memory leak

 examples/adw-demo-window.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/examples/adw-demo-window.c b/examples/adw-demo-window.c
index 3fcd6924..01fbc7b8 100644
--- a/examples/adw-demo-window.c
+++ b/examples/adw-demo-window.c
@@ -270,8 +270,12 @@ file_chooser_response_cb (AdwDemoWindow  *self,
                                  adw_avatar_get_size (self->avatar),
                                  gtk_widget_get_scale_factor (GTK_WIDGET (self)));
 
-    if (pixbuf != NULL)
-      gdk_pixbuf_save (pixbuf, g_file_get_path (file), "png", NULL, NULL);
+    if (pixbuf != NULL) {
+      g_autofree char *path = NULL;
+
+      path = g_file_get_path (file);
+      gdk_pixbuf_save (pixbuf, path, "png", NULL, NULL);
+    }
   }
 
   g_object_unref (chooser);


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