]> Pileus Git - ~andy/gtk/commitdiff
Don't leak pixbuf on error.
authorMatthias Clasen <matthiasc@src.gnome.org>
Mon, 25 Mar 2002 23:22:01 +0000 (23:22 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 25 Mar 2002 23:22:01 +0000 (23:22 +0000)
* io-tiff.c (tiff_image_parse): Don't leak pixbuf on error.

* io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't leak
context->buf on error.

* gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Make sure to call
stop_load even for short images to prevent memleaks.

gdk-pixbuf/ChangeLog
gdk-pixbuf/gdk-pixbuf-loader.c
gdk-pixbuf/io-gif.c
gdk-pixbuf/io-tiff.c

index e973c974629a2c7b20ad8cdef3556432ece60160..0d79705001c647de3081efa35c2f1edd2b95da06 100644 (file)
@@ -1,3 +1,13 @@
+2002-03-26  Matthias Clasen  <maclas@gmx.de>
+
+       * io-tiff.c (tiff_image_parse): Don't leak pixbuf on error.
+
+       * io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't leak
+       context->buf on error.
+
+       * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Make sure to call
+       stop_load even for short images to prevent memleaks.
+
 2002-03-25  Matthias Clasen  <maclas@gmx.de>
 
        * io-png.c (setup_png_transformations): Changed signature to
index 7f344326eeb58a22a3bff6dc3f8db3e2533d93f0..a199aa17f5ea8ccbf924d5df0d4e87f8131119e2 100644 (file)
@@ -536,8 +536,10 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
          retval = FALSE;
        }
     }  
-  if (retval && priv->image_module && priv->image_module->stop_load && priv->context)
-    retval = priv->image_module->stop_load (priv->context, error);
+  if (priv->image_module && priv->image_module->stop_load && priv->context) {
+    if (!priv->image_module->stop_load (priv->context, error))
+      retval = FALSE;
+  }
   
   priv->closed = TRUE;
   
index a5cab7a46900d9c399c438dd342981a671a61258..09c843e840726515df5aa9efc14b7f86374e0e95 100644 (file)
@@ -1485,7 +1485,8 @@ gdk_pixbuf__gif_image_load_increment (gpointer data,
        retval = gif_main_loop (context);
 
        if (retval == -2) {
-                context->buf = NULL;
+               if (context->buf == buf)
+                        context->buf = NULL;
                return FALSE;
         }
        if (retval == -1) {
index ff4a3dab15ab3613c347f529795a3c493b5c03b6..dac728230a41c7237be8de0c561fde27f49b6736 100644 (file)
@@ -192,6 +192,8 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
                              GDK_PIXBUF_ERROR,
                              GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
                              _("Insufficient memory to open TIFF file"));
+                g_object_unref (pixbuf);
+
                 return NULL;
        }
         
@@ -199,6 +201,7 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
                 tiff_set_error (error,
                                 GDK_PIXBUF_ERROR_FAILED,
                                 _("Failed to load RGB data from TIFF file"));
+                g_object_unref (pixbuf);
                 _TIFFfree (rast);
 
                 return NULL;