Page 1 of 1

Possible memory leak - profile.c

Posted: 2008-12-09T19:10:16-07:00
by dirving
There may be a memory leak in profile.c in the method 'GetProfilesFromResourceBlock' in ImageMagick 6.4.7-5. The variable 'profile' is declared and malloc'ed via the AquireStringInfo method and never freed. Here is the associated valgrind snippet:

==30403== 65,764 (32,864 direct, 32,900 indirect) bytes in 8 blocks are definitely lost in loss record 19 of 20
==30403== at 0x4006AEE: malloc (vg_replace_malloc.c:207)
==30403== by 0x4210A35: AcquireMagickMemory (memory.c:337)
==30403== by 0x426CA68: AcquireStringInfo (string.c:160)
==30403== by 0x422BA3F: SetImageProfile (profile.c:1340)
==30403== by 0x400F496: ???
==30403== by 0x40123B0: ???
==30403== by 0x417EF77: ReadImage (constitute.c:572)
==30403== by 0x40BECCB: MagickReadImage (magick-image.c:7613)

Re: Possible memory leak - profile.c

Posted: 2008-12-09T19:31:51-07:00
by magick
We can reproduce the problem you posted and have a patch. Look for it in the next point release of ImageMagick.

Re: Possible memory leak - profile.c

Posted: 2009-03-18T05:43:03-07:00
by magick
Do you have a specific command and / or image that generates the leak? We ran valgrind against everything GIF with the latest ImageMagick release, 6.5.0, and fortunately no leaks are reported.