Skip to content

Commit

Permalink
eliminate rare memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Mar 2, 2024
1 parent 4eb3fc8 commit 3fb6732
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions coders/icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 3fb6732

Please sign in to comment.