Re: [xml] memory leak while parsing from memory buffer

On Wed, Apr 07, 2004 at 08:38:12PM +0200, Petr Pajas wrote:
I'm terribly sorry, it's all my fault. I didn't notice, that several
lines down we overwrite doc->URL without freeing it if non-NULL:

 SV * newURI = sv_2mortal(newSVpvf("unknown-%12.12d", (void*)real_doc));
 doc->URL = xmlStrdup((const xmlChar*)SvPV_nolen(newURI));

which is where the copy is and hence the leak. 

  haha, no problem :-)

Thanks for your time,

  In my experience nothing replace running regression tests with memory
debug enabled before any commit to the code base. I don't know if you can
do that with perl, but it saved tremendous amount of time for libxml2 and
libxslt because the leak show up at the moment you try to commit the guilty
code to the CVS base, not weeks or months later.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]