Re: [GD-DEVEL] Re: Memory leak

[email protected] (Takeshi Abe) Thu, 27 Nov 2008 03:20:57 +0900 (JST)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Hi Brian,

On Wed, 26 Nov 2008 10:23:03 -0600, Brian Peschel <[email protected]> wrote:
> Valgrind is also reporting a slightly different leak in the same code
> 
> ==16200== 936,771 (561,456 direct, 375,315 indirect) bytes in 137 blocks are definitely lost in loss record
> 742 of 744
> ==16200==    at 0x4004864: calloc (vg_replace_malloc.c:279)
> ==16200==    by 0xD8FA2D: xpmParseColors (in /usr/lib/libXpm.so.4.11.0)
> ==16200==    by 0xD903F0: xpmParseData (in /usr/lib/libXpm.so.4.11.0)
> ==16200==    by 0xD893B9: XpmReadFileToXpmImage (in /usr/lib/libXpm.so.4.11.0)
> ==16200==    by 0x80CBED5: gdImageCreateFromXpm (in )
> ==16200==    by 0x437E45F: XpmImageConverter::getImageDimensions() ()
> 
> Does this help or complicate things?

Thanks for your reports!
I have reproduced the leaks too. It must be a libgd's bug (so opened
http://bugs.libgd.org/?do=details&task_id=185 ), and its cause is that
gdImageCreateFromXpm() forgot to release the resource allocated by
xpmParseData etc.
I'll prepare a fix for it asap.

Cheers,
-- Takeshi Abe