Possible memory leak - profile.c

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
dirving
Posts: 13
Joined: 2008-08-28T13:45:14-07:00

Possible memory leak - profile.c

Post 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)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible memory leak - profile.c

Post by magick »

We can reproduce the problem you posted and have a patch. Look for it in the next point release of ImageMagick.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible memory leak - profile.c

Post 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.
Post Reply