summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-jpeg.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2001-09-14 22:04:55 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2001-09-14 22:04:55 +0000
commit49b3e05a30bb7de83f3c1016d11ee7e482f439a5 (patch)
treeb3cafb1c7355ae8a6fbd4e6ca94ab2d6b2010f8a /gdk-pixbuf/io-jpeg.c
parenta5f9754350e803af7838a3c98a34418077e52fbb (diff)
downloadgdk-pixbuf-49b3e05a30bb7de83f3c1016d11ee7e482f439a5.tar.gz
Robustness fixes and test images for the jpeg, tiff, pnm, gif, xpm and tga
loaders.
Diffstat (limited to 'gdk-pixbuf/io-jpeg.c')
-rw-r--r--gdk-pixbuf/io-jpeg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 6864a7895..f04c954f9 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -337,7 +337,16 @@ gdk_pixbuf__jpeg_image_begin_load (ModulePreparedNotifyFunc prepared_func,
/* create libjpeg structures */
jpeg_create_decompress (&context->cinfo);
- context->cinfo.src = (struct jpeg_source_mgr *) g_new0 (my_source_mgr, 1);
+ context->cinfo.src = (struct jpeg_source_mgr *) g_try_malloc (sizeof (my_source_mgr));
+ if (!context->cinfo.src) {
+ g_set_error (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
+ _("Couldn't allocate memory for loading JPEG file"));
+ return NULL;
+ }
+ memset (context->cinfo.src, 0, sizeof (my_source_mgr));
+
src = (my_src_ptr) context->cinfo.src;
context->cinfo.err = jpeg_std_error (&context->jerr.pub);