diff options
author | Kim Woelders <kim@woelders.dk> | 2019-11-16 21:06:41 +0100 |
---|---|---|
committer | Kim Woelders <kim@woelders.dk> | 2019-11-16 21:09:16 +0100 |
commit | 9bae2c9f0232cc7f4395dece1207365259e4198b (patch) | |
tree | 13caa191332a6368a572a50e63dc8e9f43da9c66 | |
parent | a2cb8276e5bff36f5564290a4162f4ab29d3e23b (diff) | |
download | imlib2-9bae2c9f0232cc7f4395dece1207365259e4198b.tar.gz |
TGA loader: Tweak error handling
-rw-r--r-- | src/modules/loaders/loader_tiff.c | 25 |
1 files 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; } |