Here is the critical code:
…
viff_colormap=MagickAllocateMemory(unsigned char *,viff_colormap_size);//502
if (viff_colormap == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,
image);
/*
Read VIFF raster colormap.
*/
if (ReadBlob(image,viff_colormap_size,(char *) viff_colormap)
!= viff_colormap_size)
ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image);//513
...
Line 513 do not free memory about viff_colormap, this will cause memory leak.
Credit: ADLab of Venustech
This problem is fixed by Mercurial changeset 15187:149193fc8881. Thanks for the report!