]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1345
authorCristy <urban-warrior@imagemagick.org>
Sat, 13 Oct 2018 15:09:28 +0000 (11:09 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 13 Oct 2018 15:09:28 +0000 (11:09 -0400)
coders/pdb.c

index e7fe2c7f1f5ba71a7dc12fda07df25ff74b1a554..2695ea049c9faea6cd82133afc05ebbc925bdbc1 100644 (file)
@@ -884,7 +884,12 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image,
   quantum_info=AcquireQuantumInfo(image_info,image);
   if (quantum_info == (QuantumInfo *) NULL)
     {
-      runlength=(unsigned char *) RelinquishMagickMemory(runlength);
+      if (runlength != (unsigned char *) NULL)
+        runlength=(unsigned char *) RelinquishMagickMemory(runlength);
+      if (buffer != (unsigned char *) NULL)
+        buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+      if (scanline != (unsigned char *) NULL)
+        scanline=(unsigned char *) RelinquishMagickMemory(scanline);
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     }
   status=SetQuantumDepth(image,quantum_info,image->depth > 8 ? 16 : 8);