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

 

Thanks!!!

 

Regards

Ashwin

*** memleakfixparser.c  2008-01-23 22:26:23.000000000 -0800
--- parser.c    2008-01-10 22:36:20.000000000 -0800
*************** xmlParseElementChildrenContentDecl (xmlP
*** 5332,5339 ****
            }
        } else {
            xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, NULL);
-               if ((last != NULL) && (last != ret))
-               xmlFreeDocElementContent(ctxt->myDoc, last);
            if (ret != NULL)
                xmlFreeDocElementContent(ctxt->myDoc, ret);
            return(NULL);
--- 5332,5337 ----
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to