From 387adbe4b05a545b9f3972e862602480c850303c Mon Sep 17 00:00:00 2001 From: Cristy Date: Tue, 25 Jul 2017 08:13:15 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/618 --- coders/png.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- 2.50.1