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

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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