diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index e973c97462..0d79705001 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,13 @@ +2002-03-26 Matthias Clasen + + * 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 * io-png.c (setup_png_transformations): Changed signature to diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index 7f344326ee..a199aa17f5 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -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; diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index a5cab7a469..09c843e840 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -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) { diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index ff4a3dab15..dac728230a 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -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;