Hi, I'm experiencing a memory leak when using xmlNodeDump() from libxml 2.6.7. The following short snippet recreates the problem: ------8<-------8<--------- #include <libxml/tree.h> #include <libxml/parser.h> int main(void){ xmlDocPtr doc = xmlParseFile("test.xml"); xmlBufferPtr buff = xmlBufferCreate(); xmlNodeDump(buff,doc,doc->children,0,0); xmlBufferFree(buff); xmlFreeDoc(doc); } ----8<-------8<------ The problem seems to be caused because there's a call to xmlInitParser() in xmlNodeDump(), but no corresponding call to xmlCleanupParser(). The attached patch fixes the problem by adding a call to xmlCleanupParser(). Removing the call to xmlInitParser() would probably also fix it, but I'm not 100% sure if it's needed or not. (It wasn't present in v2.5.3) Or maybe I'm using xmlNodeDump() incorrectly? Is there some other cleanup function I should be calling? Thanks, Steve
Attachment:
tree.c.patch
Description: Text document