From: Cristy Date: Tue, 20 Sep 2016 16:09:01 +0000 (-0400) Subject: https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30506 X-Git-Tag: 7.0.3-1~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f66ab157f023e1ca37a4c40bd80fd5217d30ba1f;p=imagemagick https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30506 --- diff --git a/coders/dib.c b/coders/dib.c index cc4dd3af9..30ae752eb 100644 --- a/coders/dib.c +++ b/coders/dib.c @@ -648,7 +648,10 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) { count=ReadBlob(image,length,pixels); if (count != (ssize_t) (length)) - ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); + { + pixel_info=RelinquishVirtualMemory(pixel_info); + ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); + } } else { @@ -658,7 +661,11 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) status=DecodeImage(image,dib_info.compression ? MagickTrue : MagickFalse, pixels); if (status == MagickFalse) - ThrowReaderException(CorruptImageError,"UnableToRunlengthDecodeImage"); + { + pixel_info=RelinquishVirtualMemory(pixel_info); + ThrowReaderException(CorruptImageError, + "UnableToRunlengthDecodeImage"); + } } /* Initialize image structure. @@ -877,6 +884,7 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) break; } default: + pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } pixel_info=RelinquishVirtualMemory(pixel_info);