Here it the critical code : (in WritePALMImage)
if (palm_image->compression == FaxCompression)
lastrow = MagickAllocateMemory(unsigned char *,bytes_per_row); //1857
one_row = MagickAllocateMemory(unsigned char *,bytes_per_row);
if (one_row == (unsigned char *) NULL)
ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image);
If “one_row" is NULL and “lastrow" is not NULL,the “lastrow” may cause memory leak.
Credit : ADLab of Venustech
This problem is fixed by Mercurial changeset 15195:3140397ebc5e. Thanks for the report!