Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am using the latest version of ImageMagick
- I have searched open and closed issues to ensure it has not already been reported
Description
a potential memory leak bug locates in coders/pcd.c
Steps to Reproduce
the bug locates in
https://github.com/ImageMagick/ImageMagick/blob/master/coders/pcd.c : DecodeImage() function.
the code frament is as follows: we allocate buffer memory, we freed it in normal branch,but forgot free it in exception branch
https://github.com/ImageMagick/ImageMagick/blob/master/coders/pcd.c#L186
buffer=(unsigned char *) AcquireQuantumMemory(0x800,sizeof(*buffer));
if (buffer == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
but we forget free it in
https://github.com/ImageMagick/ImageMagick/blob/master/coders/pcd.c#L286
default:
{
ThrowBinaryException(CorruptImageError,"CorruptImage",
image->filename);
}
credit: www.vackbot.com ( 墨云科技)