kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=9bae2c9f0232cc7f4395dece1207365259e4198b
commit 9bae2c9f0232cc7f4395dece1207365259e4198b Author: Kim Woelders <k...@woelders.dk> Date: Sat Nov 16 21:06:41 2019 +0100 TGA loader: Tweak error handling --- src/modules/loaders/loader_tiff.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/modules/loaders/loader_tiff.c b/src/modules/loaders/loader_tiff.c index d4998c3..30a24d2 100644 --- a/src/modules/loaders/loader_tiff.c +++ b/src/modules/loaders/loader_tiff.c @@ -306,6 +306,12 @@ load(ImlibImage * im, ImlibProgressFunction progress, if (!TIFFRGBAImageBegin((TIFFRGBAImage *) & rgba_image, tif, 1, txt)) goto quit1; + if (!rgba_image.rgba.put.any) + { + fprintf(stderr, "imlib2-tiffloader: No put function"); + goto quit2; + } + rgba_image.image = im; switch (rgba_image.rgba.orientation) { @@ -341,23 +347,14 @@ load(ImlibImage * im, ImlibProgressFunction progress, rgba_image.progress = progress; rgba_image.pper = rgba_image.py = 0; rgba_image.progress_granularity = progress_granularity; - rast = (uint32 *) _TIFFmalloc(sizeof(uint32) * num_pixels); - if ((!rast) || (!__imlib_AllocateData(im, im->w, im->h))) /* Error checking */ - { - fprintf(stderr, "imlib2-tiffloader: Out of memory\n"); + if (!__imlib_AllocateData(im, im->w, im->h)) + goto quit2; - if (rast) - _TIFFfree(rast); - __imlib_FreeData(im); - goto quit2; - } - - if (!rgba_image.rgba.put.any) + rast = (uint32 *) _TIFFmalloc(sizeof(uint32) * num_pixels); + if (!rast) { - fprintf(stderr, "imlib2-tiffloader: No put function"); - - _TIFFfree(rast); + fprintf(stderr, "imlib2-tiffloader: Out of memory\n"); __imlib_FreeData(im); goto quit2; } --