From 079d9032ac62fa108a5bf18e341fefbacd9dfb53 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Tue, 24 Mar 2009 00:28:24 +0000 Subject: [PATCH] Fix memory leak This was SVN commit r6769. --- source/tools/atlas/AtlasObject/AtlasObjectXML.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/tools/atlas/AtlasObject/AtlasObjectXML.cpp b/source/tools/atlas/AtlasObject/AtlasObjectXML.cpp index 5904ddaa21..e1ce139c48 100644 --- a/source/tools/atlas/AtlasObject/AtlasObjectXML.cpp +++ b/source/tools/atlas/AtlasObject/AtlasObjectXML.cpp @@ -119,7 +119,9 @@ static AtSmartPtr ConvertNode(xmlNodePtr node) { std::string name ("@"); name += (const char*)cur_attr->name; - std::wstring value (fromXmlChar(xmlNodeGetContent(cur_attr->children))); + xmlChar* content = xmlNodeGetContent(cur_attr->children); + std::wstring value (fromXmlChar(content)); + xmlFree(content); AtNode* newNode = new AtNode(value.c_str()); obj->children.insert(AtNode::child_pairtype( @@ -138,7 +140,9 @@ static AtSmartPtr ConvertNode(xmlNodePtr node) } else if (cur_node->type == XML_TEXT_NODE) { - std::wstring value (fromXmlChar(xmlNodeGetContent(cur_node))); + xmlChar* content = xmlNodeGetContent(cur_node); + std::wstring value (fromXmlChar(content)); + xmlFree(content); obj->value += value; } }