Here is the critical code:
…
blue=MagickAllocateMemory(unsigned short *, //5205
65536L*sizeof(unsigned short));
green=MagickAllocateMemory(unsigned short *,
65536L*sizeof(unsigned short));
red=MagickAllocateMemory(unsigned short *,
65536L*sizeof(unsigned short));
if ((blue == (unsigned short *) NULL) ||
(green == (unsigned short *) NULL) ||
(red == (unsigned short *) NULL))
ThrowWriterException(ResourceLimitError,MemoryAllocationFailed, //5214
image);
…
If one of the “blue”、“green” and “red" is not null in “if statement”,it may cause memory leak error.
Credit: ADLab of Venustech
This problem is fixed by Mercurial changeset 15208:21ec7c7a6f70. Thanks for the report!