summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2015-07-14 16:00:19 +0200
committerDavid Tardon <dtardon@redhat.com>2015-07-14 16:00:19 +0200
commitf6122c37edad438843660e4abf2792159a06a12d (patch)
tree96a810032f383338168c1ac1b7480f27d61fb69a /src
parent0aaab87fa47283c2dedc2c1c827fc56f0b24b74e (diff)
avoid memory leak
Change-Id: I66851b20c42e5a740a0401a61e8536d9b3e0b503
Diffstat (limited to 'src')
-rw-r--r--src/lib/VSDXParser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index d65308e..e889fff 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -12,6 +12,7 @@
#include <libxml/xmlstring.h>
#include <librevenge-stream/librevenge-stream.h>
#include <boost/algorithm/string.hpp>
+#include <boost/shared_ptr.hpp>
#include "VSDXParser.h"
#include "libvisio_utils.h"
#include "VSDContentCollector.h"
@@ -313,10 +314,10 @@ void libvisio::VSDXParser::processXmlDocument(librevenge::RVNGInputStream *input
case XML_REL:
if (XML_READER_TYPE_ELEMENT == tokenType)
{
- xmlChar *id = xmlTextReaderGetAttribute(reader.get(), BAD_CAST("r:id"));
+ boost::shared_ptr<xmlChar> id(xmlTextReaderGetAttribute(reader.get(), BAD_CAST("r:id")), xmlFree);
if (id)
{
- const VSDXRelationship *rel = rels.getRelationshipById((char *)id);
+ const VSDXRelationship *rel = rels.getRelationshipById((char *)id.get());
if (rel)
{
std::string type = rel->getType();
@@ -339,7 +340,6 @@ void libvisio::VSDXParser::processXmlDocument(librevenge::RVNGInputStream *input
else
processXmlNode(reader.get());
}
- xmlFree(id);
}
}
break;