]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1049
authorCristy <urban-warrior@imagemagick.org>
Sat, 24 Mar 2018 16:46:58 +0000 (12:46 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 24 Mar 2018 16:46:58 +0000 (12:46 -0400)
coders/pcx.c

index 8805658741b94b2e617dc5165691681746004d82..7fead1dc569aab93e14a7cd0c40d386858a6d6b4 100644 (file)
@@ -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))