]> git.sesse.net Git - xml-template/commitdiff
Fix an id buffer leak in the C++0x code. simple now passes without leaks.
authorsgunderson@bigfoot.com <>
Wed, 21 Sep 2011 21:51:53 +0000 (23:51 +0200)
committersgunderson@bigfoot.com <>
Wed, 21 Sep 2011 21:51:53 +0000 (23:51 +0200)
c++0x/xml-template.cpp

index e6e88a30a31e1347deb1ab3b3e78bac34bd72493..067bf730b6cfa0b2f4af94f64258dd809caee212 100644 (file)
@@ -99,7 +99,9 @@ void Substitute::process(xmlNode *node, bool clean)
                        for (xmlAttr *attr = child->properties; attr != NULL; attr = attr->next) {
                                if (strcmp(reinterpret_cast<const char *>(attr->ns->href), "http://template.sesse.net/") == 0 &&
                                    strcmp(reinterpret_cast<const char *>(attr->name), "id") == 0) {
-                                       id = reinterpret_cast<const char *>(xmlNodeGetContent(attr->children));
+                                       xmlChar *id_buf = xmlNodeGetContent(attr->children);
+                                       id = reinterpret_cast<const char *>(id_buf);
+                                       xmlFree(id_buf);
                                        id_attr = attr;
                                }
                        }