summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2017-04-02 16:14:26 +0200
committerDavid Tardon <dtardon@redhat.com>2017-04-02 16:14:26 +0200
commit7792e03501caae09ecd3536cbbe80678a12eaa2b (patch)
treebc531c395d184c1dbdef96deeb5ccccbe9ef9317
parent27ab61071e7f88e8e1c840d4b8d1c97f19293d3f (diff)
avoid memory leak
Change-Id: Ia3765cf16dfb3585443020f185dd1bc46ab38725
-rw-r--r--src/lib/ABWParser.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/ABWParser.cpp b/src/lib/ABWParser.cpp
index 5691eca..92b46de 100644
--- a/src/lib/ABWParser.cpp
+++ b/src/lib/ABWParser.cpp
@@ -185,19 +185,18 @@ bool libabw::ABWParser::processXmlDocument(librevenge::RVNGInputStream *input)
if (!input)
return false;
- xmlTextReaderPtr reader = xmlReaderForStream(input);
+ boost::shared_ptr<xmlTextReader> reader(xmlReaderForStream(input), xmlFreeTextReader);
if (!reader)
return false;
- int ret = xmlTextReaderRead(reader);
+ int ret = xmlTextReaderRead(reader.get());
while (1 == ret)
{
- int tokenType = xmlTextReaderNodeType(reader);
+ int tokenType = xmlTextReaderNodeType(reader.get());
if (XML_READER_TYPE_SIGNIFICANT_WHITESPACE != tokenType)
- processXmlNode(reader);
+ processXmlNode(reader.get());
- ret = xmlTextReaderRead(reader);
+ ret = xmlTextReaderRead(reader.get());
}
- xmlFreeTextReader(reader);
if (m_collector)
m_collector->endDocument();