From 243d8f1bb7937b2b79458016d0bba20fdb42c25d Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 28 Apr 2019 20:45:43 -0400 Subject: [PATCH] ... --- coders/mat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/coders/mat.c b/coders/mat.c index 8d704fde2..e1c4961ae 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -1277,8 +1277,14 @@ RestoreMSCWarning { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT cannot read scanrow %u from a file.", (unsigned)(MATLAB_HDR.SizeY-i-1)); + if ((image != image2) && (image2 != (Image *) NULL)) + image2=DestroyImage(image2); + if (clone_info != (ImageInfo *) NULL) + clone_info=DestroyImageInfo(clone_info); + if (quantum_info != (QuantumInfo *) NULL) + quantum_info=DestroyQuantumInfo(quantum_info); + BImgBuff=RelinquishMagickMemory(BImgBuff); ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile"); - goto ExitLoop; } if((CellType==miINT8 || CellType==miUINT8) && (MATLAB_HDR.StructureFlag & FLAG_LOGICAL)) { -- 2.40.0