Here is the critical code : (in WriteFITSImage)
fits_info=MagickAllocateMemory(char *,FITS_BLOCK_SIZE);
pixels=MagickAllocateMemory(unsigned char *,packet_size*image->columns); //768
if ((fits_info == (char *) NULL) || (pixels == (unsigned char *) NULL))
{
MagickFreeMemory(fits_info);
ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image);
}
If "fits_info" is null and the "pixels" was not null,the pixels will cause meomory leak.
Credit : ADLab of Venustech
This problem is fixed by Mercurial changeset 15196:4a1401695913. Thanks for the report!