From 7fcca7ff26c0579f3010222b9a44063ba0b45182 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 7 May 2017 12:17:31 +0200 Subject: [PATCH] Fixed memory leak reported in #476. --- coders/png.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coders/png.c b/coders/png.c index d212497dd..c194d0858 100644 --- a/coders/png.c +++ b/coders/png.c @@ -5579,7 +5579,10 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, if ((mng_info->mng_width > 65535L) || (mng_info->mng_height > 65535L)) - ThrowReaderException(ImageError,"WidthOrHeightExceedsLimit"); + { + chunk=(unsigned char *) RelinquishMagickMemory(chunk); + ThrowReaderException(ImageError,"WidthOrHeightExceedsLimit"); + } (void) FormatLocaleString(page_geometry,MagickPathExtent, "%.20gx%.20g+0+0",(double) mng_info->mng_width,(double) -- 2.40.0