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

index 5f5b1c2bef599c17d71c186a04687a4076308a05..3b089e72d6c0900d1e7db0d5df32ddc4b0a747c3 100644 (file)
@@ -3287,6 +3287,14 @@ MagickExport Image *ScaleImage(const Image *image,const size_t columns,
   if ((scanline == (double *) NULL) || (scale_scanline == (double *) NULL) ||
       (x_vector == (double *) NULL) || (y_vector == (double *) NULL))
     {
+      if ((image->rows != scale_image->rows) && (scanline != (double *) NULL))
+        scanline=(double *) RelinquishMagickMemory(scanline);
+      if (scale_scanline != (double *) NULL)
+        scale_scanline=(double *) RelinquishMagickMemory(scale_scanline);
+      if (x_vector != (double *) NULL)
+        x_vector=(double *) RelinquishMagickMemory(x_vector);
+      if (y_vector != (double *) NULL)
+        y_vector=(double *) RelinquishMagickMemory(y_vector);
       scale_image=DestroyImage(scale_image);
       ThrowImageException(ResourceLimitError,"MemoryAllocationFailed");
     }