]> granicus.if.org Git - imagemagick/commitdiff
Fixed memory leak (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6869)
authorDirk Lemstra <dirk@git.imagemagick.org>
Tue, 13 Mar 2018 06:26:22 +0000 (07:26 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Tue, 13 Mar 2018 06:26:50 +0000 (07:26 +0100)
coders/psd.c

index 02160b28813d5c7756516eb568aef94357e45be0..042f6a55c67a10411c638248e11862125506aff4 100644 (file)
@@ -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