]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/819
authorCristy <urban-warrior@imagemagick.org>
Sat, 30 Sep 2017 15:06:13 +0000 (11:06 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 30 Sep 2017 15:06:13 +0000 (11:06 -0400)
MagickCore/montage.c

index be2166905a8143f9603eb9827050dd8a876f26ed..7b64e667c76f2e3a60a52a6e2db7bb4f8849bd84 100644 (file)
@@ -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)