From: Cristy Date: Sat, 30 Sep 2017 15:22:34 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/814 X-Git-Tag: 7.0.7-5~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e64f5e9b3687d4ebc608927c63dd52f4906734f;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/814 --- diff --git a/MagickCore/colorspace.c b/MagickCore/colorspace.c index 554f5772a..f2e65a2ac 100644 --- a/MagickCore/colorspace.c +++ b/MagickCore/colorspace.c @@ -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) {