Page 1 of 1

Report a memory leak when process JP2 image.

Posted: 2013-12-23T12:12:54-07:00
by jstph
Magic, I found a small memory leak which is in the jp2.c
under the CORE_coders package

static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
{
….
//here defined a icc color profile
icc_profile=(jas_iccprof_t *) NULL;
//then made a copy of color profile which never get rid of.
if (cm_profile != (jas_cmprof_t *) NULL)
icc_profile=jas_iccprof_createfromcmprof(cm_profile);


if (icc_profile != (jas_iccprof_t *) NULL)
{
jas_stream_t
*icc_stream;

icc_stream=jas_stream_memopen(NULL,0);
if ((icc_stream != (jas_stream_t *) NULL) &&
(jas_iccprof_save(icc_profile,icc_stream) == 0) &&
(jas_stream_flush(icc_stream) == 0))
{
jas_stream_memobj_t
*blob;
//here the local variable name icc_profile which is same as outside of the block
//may need rename??
StringInfo
*icc_profile,
*profile;

....
}
}
/**
* my fix, clean up icc_profile
*/
if (icc_profile != (jas_iccprof_t *) NULL)
{
jas_iccprof_destroy(icc_profile);
}


}

Re: Report a memory leak when process JP2 image.

Posted: 2013-12-23T12:38:13-07:00
by magick
Thanks for the problem report and patch. Look for the patch in the ImageMagick Subversion repository by sometime tomorrow.

Re: Report a memory leak when process JP2 image.

Posted: 2013-12-23T12:42:15-07:00
by jstph
it is holiday, don't work this hard :) Merry Christmas and happy new year. love your work!