From 3fb6732268ba0ef6a067ed1613d807f08784dec6 Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 1 Mar 2024 20:09:10 -0500 Subject: [PATCH] eliminate rare memory leak --- coders/icon.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/coders/icon.c b/coders/icon.c index d522568f3..f477e3f1e 100644 --- a/coders/icon.c +++ b/coders/icon.c @@ -248,8 +248,11 @@ static Image *Read1XImage(Image *image,ExceptionInfo *exception) rows=(size_t) (ReadBlobLSBShort(image)); (void) ReadBlobLSBShort(image); /* width of bitmap in bytes */ (void) ReadBlobLSBShort(image); /* cursor color */ - if ((rows != 32 && rows != 64) || (columns != 32 && columns != 64)) - ThrowImageException(CorruptImageError,"ImproperImageHeader"); + if (((rows != 32) && (rows != 64)) || ((columns != 32) && (columns != 64))) + { + image=DestroyImageList(image); + ThrowImageException(CorruptImageError,"ImproperImageHeader"); + } /* Convert bitmap scanline. */ @@ -304,7 +307,8 @@ static Image *Read1XImage(Image *image,ExceptionInfo *exception) break; } } - (void) SyncImage(image); + if (SyncImage(image) == MagickFalse) + return(DestroyImageList(image)); if (CloseBlob(image) == MagickFalse) return(DestroyImageList(image)); return(GetFirstImageInList(image));