[gimp] app: don't leak the GFileInfo in file_open_image() and file_save()



commit ba065a31ecc791f504ff2d0496dd5b486fe141e6
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 7 15:23:19 2014 +0200

    app: don't leak the GFileInfo in file_open_image() and file_save()

 app/file/file-open.c |    4 ++++
 app/file/file-save.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 59f0000..48c4d12 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -132,6 +132,7 @@ file_open_image (Gimp                *gimp,
         {
           g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                                _("Not a regular file"));
+          g_object_unref (info);
           return NULL;
         }
 
@@ -140,8 +141,11 @@ file_open_image (Gimp                *gimp,
         {
           g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                                _("Premission denied"));
+          g_object_unref (info);
           return NULL;
         }
+
+      g_object_unref (info);
     }
 
   if (! g_file_is_native (file) &&
diff --git a/app/file/file-save.c b/app/file/file-save.c
index 09bb81b..c17b3d4 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -113,6 +113,7 @@ file_save (Gimp                *gimp,
         {
           g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                                _("Not a regular file"));
+          g_object_unref (info);
           goto out;
         }
 
@@ -121,8 +122,11 @@ file_save (Gimp                *gimp,
         {
           g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                                _("Permission denied"));
+          g_object_unref (info);
           goto out;
         }
+
+      g_object_unref (info);
     }
 
   if (! g_file_is_native (file) &&


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