From 43f70257c4064b93ed8be1f20e4bd7c33e14a84a Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 13 Oct 2018 11:09:28 -0400 Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1345 --- coders/pdb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coders/pdb.c b/coders/pdb.c index e7fe2c7f1..2695ea049 100644 --- a/coders/pdb.c +++ b/coders/pdb.c @@ -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); -- 2.50.1