From df8a62fe4938aa41a39e815937c58bc0ed21b664 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 24 Mar 2018 12:46:58 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1049 --- coders/pcx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coders/pcx.c b/coders/pcx.c index 880565874..7fead1dc5 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -998,7 +998,11 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image, pcx_colormap=(unsigned char *) AcquireQuantumMemory(256UL, 3*sizeof(*pcx_colormap)); if (pcx_colormap == (unsigned char *) NULL) - ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); + { + if (page_table != (MagickOffsetType *) NULL) + page_table=(MagickOffsetType *) RelinquishMagickMemory(page_table); + ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); + } (void) memset(pcx_colormap,0,3*256*sizeof(*pcx_colormap)); q=pcx_colormap; if ((image->storage_class == PseudoClass) && (image->colors <= 256)) -- 2.40.0