From 7b604a554dfb6630fe32e739334fa57341dc6123 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Mon, 17 Jul 2017 23:13:50 +0200 Subject: [PATCH] Fix another leak related to #574. --- MagickCore/quantize.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MagickCore/quantize.c b/MagickCore/quantize.c index 851a24015..5281ee2c4 100644 --- a/MagickCore/quantize.c +++ b/MagickCore/quantize.c @@ -3395,8 +3395,11 @@ static MagickBooleanType SetGrayscaleImage(Image *image, IntensityCompare); colormap=(PixelInfo *) AcquireQuantumMemory(image->colors,sizeof(*colormap)); if (colormap == (PixelInfo *) NULL) - ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", - image->filename); + { + colormap_index=(ssize_t *) RelinquishMagickMemory(colormap_index); + ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", + image->filename); + } j=0; colormap[j]=image->colormap[0]; for (i=0; i < (ssize_t) image->colors; i++) -- 2.40.0