From: Cristy Date: Tue, 25 Jul 2017 12:13:15 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/618 X-Git-Tag: 7.0.6-4~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=387adbe4b05a545b9f3972e862602480c850303c;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/618 --- diff --git a/coders/png.c b/coders/png.c index 0191f3aff..a3a84bc1c 100644 --- a/coders/png.c +++ b/coders/png.c @@ -4405,7 +4405,14 @@ static Image *ReadOneJNGImage(MngInfo *mng_info, if (length != 0) { if (length > GetBlobSize(image)) - ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); + { + if (color_image != (Image *) NULL) + color_image=DestroyImage(color_image); + if (color_image_info != (ImageInfo *) NULL) + color_image_info=DestroyImageInfo(color_image_info); + ThrowReaderException(CorruptImageError, + "InsufficientImageDataInFile"); + } chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk)); if (chunk == (unsigned char *) NULL)