From bea69d3ad960a24dbd76bfb6026bdcfb0a8f25e5 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 24 Mar 2018 12:38:33 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1040 --- coders/bgr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { -- 2.40.0