diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2001-08-20 06:47:28 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2001-08-20 06:47:28 +0000 |
commit | d504d82aa8d5cd87ae96753718635a8f1d2d70fe (patch) | |
tree | ee37e54857482ee8850151cf1f9cd332f04b38ed /gdk-pixbuf/io-jpeg.c | |
parent | 9b14c046826ac88885fc7ad9bbd9deeecd06e142 (diff) | |
download | gtk+-d504d82aa8d5cd87ae96753718635a8f1d2d70fe.tar.gz |
Add ico and wbmp tests. Fail with a suitable error if buffer allocation
* test-images.h, test-loaders.c: Add ico and wbmp tests.
* io-jpeg.c (gdk_pixbuf__jpeg_image_save): Fail with a suitable
error if buffer allocation fails.
* io-ico.c: Make .ICO loader more robust.
All of these are due to sandmann@daimi.au.dk (#50187)
Diffstat (limited to 'gdk-pixbuf/io-jpeg.c')
-rw-r--r-- | gdk-pixbuf/io-jpeg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index c707d347af..6864a7895f 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -693,7 +693,14 @@ gdk_pixbuf__jpeg_image_save (FILE *f, g_return_val_if_fail (pixels != NULL, FALSE); /* allocate a small buffer to convert image data */ - buf = g_malloc (w * 3 * sizeof (guchar)); + buf = g_try_malloc (w * 3 * sizeof (guchar)); + if (!buf) { + g_set_error (error, + GDK_PIXBUF_ERROR, + GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, + _("Couldn't allocate memory for loading JPEG file")); + return FALSE; + } /* set up error handling */ jerr.pub.error_exit = fatal_error_handler; |