Report a memory leak when process JP2 image.

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Report a memory leak when process JP2 image.

Post 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);
}


}
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Report a memory leak when process JP2 image.

Post by magick »

Thanks for the problem report and patch. Look for the patch in the ImageMagick Subversion repository by sometime tomorrow.
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Re: Report a memory leak when process JP2 image.

Post by jstph »

it is holiday, don't work this hard :) Merry Christmas and happy new year. love your work!
Post Reply