From: Cristy Date: Sat, 30 Sep 2017 15:06:13 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/819 X-Git-Tag: 7.0.7-5~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f02ffadbaecb94b7bb272a983f29a14e6e026bab;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/819 --- diff --git a/MagickCore/montage.c b/MagickCore/montage.c index be2166905..7b64e667c 100644 --- a/MagickCore/montage.c +++ b/MagickCore/montage.c @@ -638,7 +638,14 @@ MagickExport Image *MontageImageList(const ImageInfo *image_info, sizeof(*montage->directory)); if ((montage->montage == (char *) NULL) || (montage->directory == (char *) NULL)) - ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); + { + if (montage->montage != (char *) NULL) + montage->montage=(char *) RelinquishMagickMemory(montage->montage); + if (montage->directory != (char *) NULL) + montage->directory=(char *) RelinquishMagickMemory( + montage->directory); + ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); + } x_offset=0; y_offset=0; if (montage_info->tile != (char *) NULL)