Here is the critical code:
do
{
chroma_image=CloneImage(image,image->columns/horizontal_factor,
image->rows/vertical_factor,True,exception);
if (chroma_image == (Image *) NULL)
ThrowYUVReaderException(ResourceLimitError,MemoryAllocationFailed,image);
/*
Convert raster image to pixel packets.
*/
if (image_info->ping && (image_info->subrange != 0))
if (image->scene >= (image_info->subimage+image_info->subrange-1))
break;
if (interlace == PartitionInterlace)
{
AppendImageFormat("Y",image->filename);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == False)
ThrowYUVReaderException(FileOpenError,UnableToOpenFile,image);//207
}
....
if (interlace == PartitionInterlace)
{
CloseBlob(image);
AppendImageFormat("U",image->filename);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == False)
ThrowYUVReaderException(FileOpenError,UnableToOpenFile,image);//291
}
...
if (interlace == PartitionInterlace)
{
CloseBlob(image);
AppendImageFormat("V",image->filename);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == False)
ThrowYUVReaderException(FileOpenError,UnableToOpenFile,image);//326
}
...
resize_image=ResizeImage(chroma_image,image->columns,image->rows,
TriangleFilter,1.0,exception);
DestroyImage(chroma_image);
if (resize_image == (Image *) NULL)
ThrowYUVReaderException(ResourceLimitError,MemoryAllocationFailed,image);
...
}
Line 207, 291, 326 do not free memory about chroma_image, this will cause memory leak.
Credit: ADLab of Venustech
This problem is fixed by Mercurial changeset 15185:45bf86da33da. Thanks for the report!