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

index 554f5772a4f9ec538c67d5eec9559148d4daf699..f2e65a2accb4d820795c3f151cf5229afc35f3d2 100644 (file)
@@ -760,8 +760,16 @@ static MagickBooleanType sRGBTransformImage(Image *image,
   if ((x_map == (TransformPacket *) NULL) ||
       (y_map == (TransformPacket *) NULL) ||
       (z_map == (TransformPacket *) NULL))
-    ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
-      image->filename);
+    {
+      if (x_map != (TransformPacket *) NULL)
+        x_map=(TransformPacket *) RelinquishMagickMemory(x_map);
+      if (y_map != (TransformPacket *) NULL)
+        y_map=(TransformPacket *) RelinquishMagickMemory(y_map);
+      if (z_map != (TransformPacket *) NULL)
+        z_map=(TransformPacket *) RelinquishMagickMemory(z_map);
+      ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+        image->filename);
+    }
   (void) ResetMagickMemory(&primary_info,0,sizeof(primary_info));
   switch (colorspace)
   {