diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2017-01-30 12:29:02 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2017-01-30 12:29:02 +0100 |
commit | acc11040cdbda3dbdfe9163e232aa98df4eb6b14 (patch) | |
tree | 380024cd2acbc00998380f55d37bb0d148ec7151 /src/gd_tiff.c | |
parent | a5570d3ed30ff76c2a8bdd54f4ab1825acca0143 (diff) | |
download | libgd-acc11040cdbda3dbdfe9163e232aa98df4eb6b14.tar.gz |
Fix Coverity #155475: Failure to restore alphaBlendingFlag
Actually, there is no need to change the alphaBlendingFlag in the first
place, if the buffer allocation fails, so we move the allocation
attempt up.
Diffstat (limited to 'src/gd_tiff.c')
-rw-r--r-- | src/gd_tiff.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gd_tiff.c b/src/gd_tiff.c index 80a9837..ae65ed7 100644 --- a/src/gd_tiff.c +++ b/src/gd_tiff.c @@ -769,17 +769,17 @@ static int createFromTiffRgba(TIFF * tif, gdImagePtr im) uint32 rgba; int success; + buffer = (uint32 *) gdCalloc(sizeof(uint32), width * height); + if (!buffer) { + return GD_FAILURE; + } + /* switch off colour merging on target gd image just while we write out * content - we want to preserve the alpha data until the user chooses * what to do with the image */ alphaBlendingFlag = im->alphaBlendingFlag; gdImageAlphaBlending(im, 0); - buffer = (uint32 *) gdCalloc(sizeof(uint32), width * height); - if (!buffer) { - return GD_FAILURE; - } - success = TIFFReadRGBAImage(tif, width, height, buffer, 1); if (success) { |