]> git.sesse.net Git - xml-template/commitdiff
Fix leak of the temporary clone root elements in the C++0x version.
authorsgunderson@bigfoot.com <>
Wed, 21 Sep 2011 21:55:09 +0000 (23:55 +0200)
committersgunderson@bigfoot.com <>
Wed, 21 Sep 2011 21:55:09 +0000 (23:55 +0200)
c++0x/xml-template.cpp

index 067bf730b6cfa0b2f4af94f64258dd809caee212..96f027033ba30acf87ca50af3c6a22a49ed03ef8 100644 (file)
@@ -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);