Don't leak pixbuf on error.

* 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.
This commit is contained in:
Matthias Clasen 2002-03-25 23:22:01 +00:00
parent 94168cf845
commit de19229a33
4 changed files with 19 additions and 3 deletions

View 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

View 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;

View 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) {

View 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;