summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2015-07-14 17:41:52 +0200
committerDavid Tardon <dtardon@redhat.com>2015-07-14 17:41:52 +0200
commit13eba01e48420e17525f271a0b1f9124fd22a8a2 (patch)
tree53df13bb3847a526c3a69a30e3a8f71e0ef4c526
parent5409f4e852318f59fc59bf56701205095954073b (diff)
fix more string leaks
Change-Id: Ifc79cf5d91a262fb4d51d13d9d183164ccc24f07
-rw-r--r--src/lib/VSDXTheme.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/VSDXTheme.cpp b/src/lib/VSDXTheme.cpp
index 85cf0ac..f962105 100644
--- a/src/lib/VSDXTheme.cpp
+++ b/src/lib/VSDXTheme.cpp
@@ -8,9 +8,14 @@
*/
#include "VSDXTheme.h"
+
+#include <boost/shared_ptr.hpp>
+
#include "VSDXMLTokenMap.h"
#include "libvisio_utils.h"
+using boost::shared_ptr;
+
libvisio::VSDXVariationClrScheme::VSDXVariationClrScheme()
: m_varColor1()
, m_varColor2()
@@ -96,7 +101,7 @@ boost::optional<libvisio::Colour> libvisio::VSDXTheme::readSrgbClr(xmlTextReader
boost::optional<libvisio::Colour> retVal;
if (XML_A_SRGBCLR == getElementToken(reader))
{
- xmlChar *val = xmlTextReaderGetAttribute(reader, BAD_CAST("val"));
+ const shared_ptr<xmlChar> val(xmlTextReaderGetAttribute(reader, BAD_CAST("val")), xmlFree);
if (val)
{
try
@@ -106,7 +111,6 @@ boost::optional<libvisio::Colour> libvisio::VSDXTheme::readSrgbClr(xmlTextReader
catch (const XmlParserException &)
{
}
- xmlFree(val);
}
}
return retVal;
@@ -117,7 +121,7 @@ boost::optional<libvisio::Colour> libvisio::VSDXTheme::readSysClr(xmlTextReaderP
boost::optional<libvisio::Colour> retVal;
if (XML_A_SYSCLR == getElementToken(reader))
{
- xmlChar *lastClr = xmlTextReaderGetAttribute(reader, BAD_CAST("lastClr"));
+ const shared_ptr<xmlChar> lastClr(xmlTextReaderGetAttribute(reader, BAD_CAST("lastClr")), xmlFree);
if (lastClr)
{
try
@@ -127,7 +131,6 @@ boost::optional<libvisio::Colour> libvisio::VSDXTheme::readSysClr(xmlTextReaderP
catch (const XmlParserException &)
{
}
- xmlFree(lastClr);
}
}
return retVal;