From: Cristy Date: Sat, 24 Mar 2018 16:38:33 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/1040 X-Git-Tag: 7.0.7-28~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bea69d3ad960a24dbd76bfb6026bdcfb0a8f25e5;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/1040 --- diff --git a/coders/bgr.c b/coders/bgr.c index d4862604c..f26459d69 100644 --- a/coders/bgr.c +++ b/coders/bgr.c @@ -165,7 +165,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info, exception); quantum_info=AcquireQuantumInfo(image_info,canvas_image); if (quantum_info == (QuantumInfo *) NULL) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); + { + canvas_image=DestroyImage(canvas_image); + ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); + } quantum_type=BGRQuantum; if (LocaleCompare(image_info->magick,"BGRA") == 0) {