Here is the critical code : (in WriteHISTOGRAMImage)
length=Max(ScaleQuantumToChar(MaxRGB)+1,histogram_image->columns);
red=MagickAllocateMemory(long *,length*sizeof(long)); //225
green=MagickAllocateMemory(long *,length*sizeof(long));
blue=MagickAllocateMemory(long *,length*sizeof(long));
if ((red == (long *) NULL) || (green == (long *) NULL) ||
(blue == (long *) NULL))
{
DestroyImage(histogram_image);
ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image)
}
If one of the “red”,”green” and ”blue” is NULL at least,and others are not,this may cause memory leak
Credit : ADLab of Venustech
This problem is fixed by Mercurial changeset 15198:9e6afa7ba7b9. Thanks for the report!