From f595a1985233c399a05c0c37cc41de16a90dd025 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 15 Jun 2019 22:02:18 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1589 --- MagickCore/annotate.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index a1145780a..494720211 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -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; -- 2.40.0