From: Cristy Date: Sat, 30 Sep 2017 14:38:44 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/809 X-Git-Tag: 7.0.7-5~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12a43437fec6f9245327636dc2730863bb9fdd8b;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/809 --- diff --git a/coders/pcd.c b/coders/pcd.c index 9cb33d60d..4982f9ff0 100644 --- a/coders/pcd.c +++ b/coders/pcd.c @@ -605,7 +605,15 @@ static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception) 10*sizeof(*luma)); if ((chroma1 == (unsigned char *) NULL) || (chroma2 == (unsigned char *) NULL) || (luma == (unsigned char *) NULL)) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); + { + if (chroma1 != (unsigned char *) NULL) + chroma1=(unsigned char *) RelinquishMagickMemory(chroma1); + if (chroma2 != (unsigned char *) NULL) + chroma2=(unsigned char *) RelinquishMagickMemory(chroma2); + if (luma != (unsigned char *) NULL) + luma=(unsigned char *) RelinquishMagickMemory(luma); + ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); + } /* Advance to image data. */