diff options
author | David Tardon <dtardon@redhat.com> | 2019-08-04 19:05:05 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2019-08-04 19:05:05 +0200 |
commit | f6c48b831afdea999ed68a9b717c78d728a0e677 (patch) | |
tree | fae7be874da283c4ff89a22e2dcbafcf56860334 | |
parent | 0a62d06de2462b6be9f086b5997a99eb2feb7246 (diff) |
cid#1452210 fix memory leak
Change-Id: Ifda9cbb926993364ddb68fcb96dc66e0c765d2ef
-rw-r--r-- | src/test/importtest.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp index 0e54d41..52c6a04 100644 --- a/src/test/importtest.cpp +++ b/src/test/importtest.cpp @@ -114,7 +114,7 @@ void assertBmpDataOffset(xmlDocPtr doc, const librevenge::RVNGString &xpath, con /// Same as the assertXPathContent(), but don't assert: return the string instead. librevenge::RVNGString getXPathContent(xmlDocPtr doc, const librevenge::RVNGString &xpath) { - xmlXPathObjectPtr xpathobject = getXPathNode(doc, xpath); + std::unique_ptr<xmlXPathObject, void(*)(xmlXPathObjectPtr)> xpathobject{getXPathNode(doc, xpath), xmlXPathFreeObject}; switch (xpathobject->type) { case XPATH_UNDEFINED: @@ -135,7 +135,6 @@ librevenge::RVNGString getXPathContent(xmlDocPtr doc, const librevenge::RVNGStri xmlchild = xmlchild->next; if (xmlchild && xmlchild->type == XML_TEXT_NODE) s = (reinterpret_cast<char *>((xmlnode->children[0]).content)); - xmlXPathFreeObject(xpathobject); return s; } case XPATH_BOOLEAN: |