From 8ac53768e1c437331a1e7d2f514af4b40a8d1b87 Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 4 Aug 2017 07:14:09 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/644 --- coders/mat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coders/mat.c b/coders/mat.c index 76a746fd5..b5c91b2aa 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -1138,7 +1138,11 @@ RestoreMSCWarning } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) - return(DestroyImageList(image)); + { + if ((image != image2) && (image2 != (Image *) NULL)) + image2=DestroyImage(image2); + return(DestroyImageList(image)); + } quantum_info=AcquireQuantumInfo(clone_info,image); if (quantum_info == (QuantumInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); -- 2.50.1