[epiphany] file-chooser: Use g_autofree



commit 1b2c1ada88db0218f1ac0ba962b6930d979a0b0a
Author: Yi-Soo An <yisooan gmail com>
Date:   Thu Feb 14 13:37:23 2019 +0900

    file-chooser: Use g_autofree
    
    Use g_autofree instead of manually freeing a resource.

 lib/widgets/ephy-file-chooser.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/lib/widgets/ephy-file-chooser.c b/lib/widgets/ephy-file-chooser.c
index d27309105..4cd906145 100644
--- a/lib/widgets/ephy-file-chooser.c
+++ b/lib/widgets/ephy-file-chooser.c
@@ -104,7 +104,7 @@ update_preview_cb (GtkFileChooser *file_chooser,
   gint preview_width = 0;
   gint preview_height = 0;
   struct g_stat st_buf;
-  g_autoptr (GdkPixbuf) pixbuf = NULL;
+  g_autoptr(GdkPixbuf) pixbuf = NULL;
 
   GdkPixbufFormat *preview_format = gdk_pixbuf_get_file_info (filename,
                                                               &preview_width,
@@ -150,7 +150,7 @@ ephy_create_file_chooser (const char           *title,
 {
   GtkFileChooser *dialog;
   GtkFileFilter *filter[EPHY_FILE_FILTER_LAST];
-  char *downloads_dir;
+  g_autofree char *downloads_dir = NULL;
   GtkWidget *preview = gtk_image_new ();
 
   g_assert (GTK_IS_WINDOW (parent));
@@ -165,7 +165,6 @@ ephy_create_file_chooser (const char           *title,
 
   downloads_dir = ephy_file_get_downloads_dir ();
   gtk_file_chooser_add_shortcut_folder (dialog, downloads_dir, NULL);
-  g_free (downloads_dir);
 
   if (action == GTK_FILE_CHOOSER_ACTION_OPEN ||
       action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||


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