From 12a43437fec6f9245327636dc2730863bb9fdd8b Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 30 Sep 2017 10:38:44 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/809 --- coders/pcd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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. */ -- 2.40.0