From 8e1d37633979005acd694fc86ee91b724fe4361b Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Wed, 21 Sep 2011 23:55:09 +0200 Subject: [PATCH] Fix leak of the temporary clone root elements in the C++0x version. --- c++0x/xml-template.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/c++0x/xml-template.cpp b/c++0x/xml-template.cpp index 067bf73..96f0270 100644 --- a/c++0x/xml-template.cpp +++ b/c++0x/xml-template.cpp @@ -57,9 +57,12 @@ void Clone::process(xmlNode *node, bool clean) xmlNode *new_node; xmlDOMWrapCloneNode(NULL, node->doc, node, &new_node, node->doc, NULL, 1, 0); it->process(new_node, clean); - for (xmlNode *child = new_node->children; child != NULL; child = child->next) { + while (new_node->children != NULL) { + xmlNode *child = new_node->children; + xmlUnlinkNode(child); new_nodes.push_back(child); } + xmlFreeNode(new_node); } xmlFreeNodeList(node->children); -- 2.39.2