- From: Eric Prud'hommeaux <eric@w3.org>
- Date: Tue, 25 Mar 2003 16:26:18 -0500 (EST)
- To: "Tokushige, Darren" <Darren.Tokushige@am.sony.com>
- Cc: www-lib@w3.org
On Tue, Mar 25, 2003 at 11:26:17AM -0800, Tokushige, Darren wrote: > found your email address on the w3c website...hope you are the right > person... > > found a memory leak in the c-based pics parser.... > > in the file CSLabel.c: > HTList_removeLastObject() is called in various places to free > dynamically allocated memory from link lists. this function is > called in a loop designed to free the entire list. however if you > look at the implementation of htlist, you will see that when the > list is created, the head node is allocated. this node can never be > freed using HTList_removeLastObject(). > > to fix the leak, after each loop that calls > HTList_removeLastObject(), you need to free that head node by > calling HTList_delete(me->???) where ??? is the list you are trying > to delete. i believe there are 10 instances of this call in > CSLabel.c. Would you mind submitting a patch or a replacement CSLabel.c ? I believe you are more likely to repair this accurately. > why htlist allocates this empty head node is beyond me. to be > honest i think the fix should really be completed in htlist, but > since so many other programs rely on this, i fixed it in CSLabel.c. yeah, that would be scary to update. I guess the nice thing is that the head node can be a subclass of a list element if you want to keep more data about the list, like indexes or that sort of thing. > anyways, just wanted to pass on the info... > darren. Indeed. Thank you kindly. -- -eric office: +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA cell: +1.857.222.5741 (eric@w3.org) Feel free to forward this message to any list for any purpose other than email address distribution.
Received on Wednesday, 26 March 2003 04:12:36 UTC