From: Dirk Lemstra Date: Thu, 18 Jan 2018 20:17:02 +0000 (+0100) Subject: Fixed memory leak. X-Git-Tag: 7.0.7-22~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6bf4c260b325aa1e99786db26b4a4236a7cf711;p=imagemagick Fixed memory leak. Credit to OSS-Fuzz --- diff --git a/coders/miff.c b/coders/miff.c index 4d80075c2..ea499ee0e 100644 --- a/coders/miff.c +++ b/coders/miff.c @@ -899,8 +899,12 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, profile=BlobToStringInfo((const void *) NULL,(size_t) StringToLong(options)); if (profile == (StringInfo *) NULL) - ThrowReaderException(ResourceLimitError, - "MemoryAllocationFailed"); + { + profiles=DestroyLinkedList(profiles, + RelinquishMagickMemory); + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); + } (void) SetImageProfile(image,keyword+8,profile,exception); profile=DestroyStringInfo(profile); break; diff --git a/coders/mpc.c b/coders/mpc.c index 67695ecc6..421bf545a 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -631,8 +631,12 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) profile=BlobToStringInfo((const void *) NULL,(size_t) StringToLong(options)); if (profile == (StringInfo *) NULL) - ThrowReaderException(ResourceLimitError, - "MemoryAllocationFailed"); + { + profiles=DestroyLinkedList(profiles, + RelinquishMagickMemory); + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); + } (void) SetImageProfile(image,keyword+8,profile,exception); profile=DestroyStringInfo(profile); break;