[gimp] Fix some memleaks



commit ce3db28f5abe3667a97be3ad2d44a0794efecb16
Author: Nelson A. de Oliveira <naoliv debian org>
Date:   Wed Aug 17 14:13:42 2011 -0300

    Fix some memleaks

 plug-ins/common/guillotine.c |    2 ++
 plug-ins/file-psd/psd-util.c |    4 ++++
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/common/guillotine.c b/plug-ins/common/guillotine.c
index ccec643..ef3d455 100644
--- a/plug-ins/common/guillotine.c
+++ b/plug-ins/common/guillotine.c
@@ -242,6 +242,8 @@ guillotine (gint32   image_ID,
               if (new_image == -1)
                 {
                   g_warning ("Couldn't create new image.");
+                  g_free (hformat);
+                  g_free (format);
                   return images;
                 }
 
diff --git a/plug-ins/file-psd/psd-util.c b/plug-ins/file-psd/psd-util.c
index cc45110..661d17e 100644
--- a/plug-ins/file-psd/psd-util.c
+++ b/plug-ins/file-psd/psd-util.c
@@ -115,6 +115,7 @@ fread_pascal_string (gint32         *bytes_read,
           if (fseek (f, 1, SEEK_CUR) < 0)
             {
               psd_set_error (feof (f), errno, error);
+              g_free (str);
               return NULL;
             }
           (*bytes_read)++;
@@ -174,12 +175,14 @@ fwrite_pascal_string (const gchar    *src,
           || fwrite (pascal_str, pascal_len, 1, f) < 1)
         {
           psd_set_error (feof (f), errno, error);
+          g_free (pascal_str);
           return -1;
         }
       bytes_written++;
       bytes_written += pascal_len;
       IFDBG(2) g_debug ("Pascal string: %s, bytes_written: %d",
                         pascal_str, bytes_written);
+      g_free (pascal_str);
     }
 
   /* Pad with nulls */
@@ -263,6 +266,7 @@ fread_unicode_string (gint32         *bytes_read,
           if (fseek (f, 1, SEEK_CUR) < 0)
             {
               psd_set_error (feof (f), errno, error);
+              g_free (utf16_str);
               return NULL;
             }
           (*bytes_read)++;



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