From: sgunderson@bigfoot.com <> Date: Wed, 21 Sep 2011 21:51:53 +0000 (+0200) Subject: Fix an id buffer leak in the C++0x code. simple now passes without leaks. X-Git-Url: https://git.sesse.net/?p=xml-template;a=commitdiff_plain;h=47a96d1f08578ba143b50a7e83c0338dcebcacc6 Fix an id buffer leak in the C++0x code. simple now passes without leaks. --- diff --git a/c++0x/xml-template.cpp b/c++0x/xml-template.cpp index e6e88a3..067bf73 100644 --- a/c++0x/xml-template.cpp +++ b/c++0x/xml-template.cpp @@ -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(attr->ns->href), "http://template.sesse.net/") == 0 && strcmp(reinterpret_cast(attr->name), "id") == 0) { - id = reinterpret_cast(xmlNodeGetContent(attr->children)); + xmlChar *id_buf = xmlNodeGetContent(attr->children); + id = reinterpret_cast(id_buf); + xmlFree(id_buf); id_attr = attr; } }