From: Dirk Lemstra Date: Tue, 2 May 2017 06:38:06 +0000 (+0200) Subject: Fixed memory leak reported in #458. X-Git-Tag: 7.0.5-6~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53ff6cadfa2051296d3bd67c06a693043222c4d6;p=imagemagick Fixed memory leak reported in #458. --- diff --git a/coders/mpc.c b/coders/mpc.c index 2b8e6ab92..8088da492 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -872,12 +872,16 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,packet_size*image->colors,colormap); if (count != (ssize_t) (packet_size*image->colors)) - ThrowReaderException(CorruptImageError, - "InsufficientImageDataInFile"); + { + colormap=(unsigned char *) RelinquishMagickMemory(colormap); + ThrowReaderException(CorruptImageError, + "InsufficientImageDataInFile"); + } p=colormap; switch (depth) { default: + colormap=(unsigned char *) RelinquishMagickMemory(colormap); ThrowReaderException(CorruptImageError, "ImageDepthNotSupported"); case 8: