Re: [xml] Memory Leak in xmlParseElementChildrenContentDecl



On Thu, Jan 24, 2008 at 12:07:13PM +0530, Ashwin wrote:

   Hi,

    >   There   seems   to   be   a   memory   leak   in   the   function
   xmlParseElementChildrenContentDecl  (libxml  release 28). When I parse
   the attached document using any of the > >  Api's provided for DOM/Sax
   with  purify  a  memory  leak is shown for the memory allocated at the
   following location in function xmlNewDocElementContent

   >  ret = (xmlElementContentPtr) xmlMalloc(sizeof(xmlElementContent));

   >   The  memory  allocated for b in the attached document is not being
   freed.

    > <!ELEMENT aElement (a |b * >

    Hi,

             I  think  the  addition of the following code should fix the
   problem, added in parser.c at line no 5335

   if ((last != NULL) && (last != ret))

                  xmlFreeDocElementContent(ctxt->myDoc, last);

   Please confirm that it is correct

  Yes, you are right. I tested the problem when I got your report
but didn't had time to check the fix, this looks right, I commited this in
SVN and added the patch to the regressions tests,

  thanks a lot !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
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]