From cc0c274ab48363f5a590bcd1b283d7aec01aeae7 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Thu, 22 Sep 2011 02:14:48 +0200 Subject: [PATCH] Fix a Valgrind hit; we cannot take c_str() of a temporary object. --- c++0x/xml-template.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c++0x/xml-template.cpp b/c++0x/xml-template.cpp index 5bbcb9b..317a561 100644 --- a/c++0x/xml-template.cpp +++ b/c++0x/xml-template.cpp @@ -196,13 +196,13 @@ void Substitute::process(xmlNode *node, bool clean) // Attribute substitution. if (begins_with(it.first, tag + "/")) { const xmlChar *attr_key = reinterpret_cast( - it.first.substr(tag.size() + 1).c_str()); + it.first.c_str() + tag.size() + 1); const xmlChar *attr_value = reinterpret_cast( it.second->get_contents().c_str()); xmlSetProp(child, attr_key, attr_value); } else if ((!id.empty() && begins_with(it.first, "#" + id + "/"))) { const xmlChar *attr_key = reinterpret_cast( - it.first.substr(tag.size() + 2).c_str()); + it.first.c_str() + tag.size() + 2); const xmlChar *attr_value = reinterpret_cast( it.second->get_contents().c_str()); xmlSetProp(child, attr_key, attr_value); -- 2.39.2