From: Dirk Lemstra Date: Sun, 28 Apr 2019 08:32:24 +0000 (+0200) Subject: Fixed memory leak reported in #1558 and fixed other leak. X-Git-Tag: 7.0.8-43~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f050a9b18ba537952abf20db2e18d62f07b4956e;p=imagemagick Fixed memory leak reported in #1558 and fixed other leak. --- diff --git a/coders/dot.c b/coders/dot.c index a9410aa9f..47e926352 100644 --- a/coders/dot.c +++ b/coders/dot.c @@ -129,10 +129,7 @@ static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception) image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) - { - image=DestroyImageList(image); - return((Image *) NULL); - } + return(DestroyImageList(image)); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) CopyMagickString(read_info->magick,"SVG",MagickPathExtent); @@ -147,7 +144,7 @@ static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception) if (graph == (graph_t *) NULL) { (void) RelinquishUniqueFileResource(read_info->filename); - return ((Image *) NULL); + return(DestroyImageList(image)); } option=GetImageOption(image_info,"dot:layout-engine"); if (option == (const char *) NULL) @@ -157,6 +154,7 @@ static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception) gvRenderFilename(graphic_context,graph,(char *) "svg",read_info->filename); gvFreeLayout(graphic_context,graph); agclose(graph); + image=DestroyImageList(image); /* Read SVG graph. */