From: Cristy Date: Sat, 30 Sep 2017 15:28:00 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/812 X-Git-Tag: 7.0.7-5~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=20e12d0e5dc6ba470985aaf745840c93ffa9b134;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/812 --- diff --git a/coders/png.c b/coders/png.c index fa9055fb6..99b458b27 100644 --- a/coders/png.c +++ b/coders/png.c @@ -6908,9 +6908,13 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, if ((prev == (Quantum *) NULL) || (next == (Quantum *) NULL)) { - image=DestroyImageList(image); - ThrowReaderException(ResourceLimitError, - "MemoryAllocationFailed"); + if (prev != (Quantum *) NULL) + prev=(Quantum *) RelinquishMagickMemory(prev); + if (next != (Quantum *) NULL) + next=(Quantum *) RelinquishMagickMemory(next); + image=DestroyImageList(image); + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); } n=GetAuthenticPixels(image,0,0,image->columns,1,exception);