From 543e6448d2821f4f70ef2970afba421b89001fe6 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Tue, 13 Mar 2018 07:26:22 +0100 Subject: [PATCH] Fixed memory leak (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6869) --- coders/psd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/coders/psd.c b/coders/psd.c index 02160b288..042f6a55c 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -2302,6 +2302,8 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (image_info->ping != MagickFalse) { + if (profile != (StringInfo *) NULL) + profile=DestroyStringInfo(profile); (void) CloseBlob(image); return(GetFirstImageInList(image)); } @@ -2322,17 +2324,13 @@ static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) exception); if (status != MagickTrue) { + if (profile != (StringInfo *) NULL) + profile=DestroyStringInfo(profile); (void) CloseBlob(image); image=DestroyImageList(image); return((Image *) NULL); } } - if (profile != (StringInfo *) NULL) - { - (void) SetImageProfile(image,GetStringInfoName(profile),profile, - exception); - profile=DestroyStringInfo(profile); - } if (has_merged_image == MagickFalse) { Image -- 2.40.0