From: Dirk Lemstra Date: Sat, 16 Sep 2017 13:44:04 +0000 (+0200) Subject: Fix more leaks based on changes in #763 X-Git-Tag: 7.0.7-3~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81a09b09ac3fae3c58366672aa494d2c43a40034;p=imagemagick Fix more leaks based on changes in #763 --- diff --git a/coders/cut.c b/coders/cut.c index 6ae02e81e..ac5b6a4c1 100644 --- a/coders/cut.c +++ b/coders/cut.c @@ -509,6 +509,10 @@ static Image *ReadCUTImage(const ImageInfo *image_info,ExceptionInfo *exception) offset=SeekBlob(image,6 /*sizeof(Header)*/,SEEK_SET); if (offset < 0) { + if (palette != NULL) + palette=DestroyImage(palette); + if (clone_info != NULL) + clone_info=DestroyImageInfo(clone_info); BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } diff --git a/coders/dps.c b/coders/dps.c index e4430beb3..e110c3b60 100644 --- a/coders/dps.c +++ b/coders/dps.c @@ -316,12 +316,18 @@ static Image *ReadDPSImage(const ImageInfo *image_info,ExceptionInfo *exception) { (void) CloseBlob(image); colors=(XColor *) RelinquishMagickMemory(colors); + XDestroyImage(dps_image); + XFreeResources(display,visual_info,map_info,(XPixelInfo *) NULL, + (XFontStruct *) NULL,&resource_info,(XWindowInfo *) NULL); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { colors=(XColor *) RelinquishMagickMemory(colors); + XDestroyImage(dps_image); + XFreeResources(display,visual_info,map_info,(XPixelInfo *) NULL, + (XFontStruct *) NULL,&resource_info,(XWindowInfo *) NULL); return(DestroyImageList(image)); } switch (image->storage_class) diff --git a/coders/gif.c b/coders/gif.c index d87279f5f..9ea4c426e 100644 --- a/coders/gif.c +++ b/coders/gif.c @@ -1186,6 +1186,7 @@ static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception) { meta_image=DestroyImage(meta_image); global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap); + info=(unsigned char *) RelinquishMagickMemory(info); ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); }