]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1589
authorCristy <urban-warrior@imagemagick.org>
Sun, 16 Jun 2019 02:02:18 +0000 (22:02 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 16 Jun 2019 02:02:18 +0000 (22:02 -0400)
MagickCore/annotate.c

index a1145780aca478f80967b7e29b58981f4623a7a8..494720211e42429c2dd39e2848ef5166162b26f7 100644 (file)
@@ -274,7 +274,11 @@ MagickExport MagickBooleanType AnnotateImage(Image *image,
       number_lines++;
   textlist=AcquireQuantumMemory(number_lines+1,sizeof(*textlist));
   if (textlist == (char **) NULL)
-    return(MagickFalse);
+    {
+      annotate_info=DestroyDrawInfo(annotate_info);
+      annotate=DestroyDrawInfo(annotate);
+      return(MagickFalse);
+    }
   p=text;
   for (i=0; i < number_lines; i++)
   {
@@ -303,7 +307,12 @@ MagickExport MagickBooleanType AnnotateImage(Image *image,
       (void) ParseGeometry(annotate_info->geometry,&geometry_info);
     }
   if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
-    return(MagickFalse);
+    {
+      annotate_info=DestroyDrawInfo(annotate_info);
+      annotate=DestroyDrawInfo(annotate);
+      textlist=(char **) RelinquishMagickMemory(textlist);
+      return(MagickFalse);
+    }
   if (IsGrayColorspace(image->colorspace) != MagickFalse)
     (void) SetImageColorspace(image,sRGBColorspace,exception);
   status=MagickTrue;