Memory leak in PNG coder

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Posts: 19
Joined: 2005-06-30T06:08:40-07:00
Location: France

Memory leak in PNG coder

Post by mootools » 2007-06-08T13:06:31-07:00


I found a memory leak in png.c file, function png_read_raw_profile:

the memory allocated at line:

info=(unsigned char *) AcquireMagickMemory(length);

is not always released.

we should release the memory somewhere below:

We have already read "Raw profile type,
info=(unsigned char *) RelinquishMagickMemory(info); // line to be added
(void) SetImageProfile(image,&text[ii].key[17],profile);
if (image_info->verbose)
(void) printf(" Found a generic profile, type %s\n",&text[ii].key[17]);
return MagickTrue;


Manuel - Mootools

PS: by the way, is it a correct way to suggest a correction?
Should I make the correction myself using a cvs tool or something like that?
I sometime post bug report but I am never sure that they are taken into account.
Manuel Jouglet

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

Re: Memory leak in PNG coder

Post by magick » 2007-06-08T14:58:42-07:00

We confirm the memory leak. We improved your patch a bit and will ensure it becomes part of the next ImageMagick release. Thanks.

Post Reply