summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2019-07-04 18:37:20 +0200
committerJulien Nabet <serval2412@yahoo.fr>2019-07-04 21:51:50 +0200
commit9a6850ba8ef77e4ecf84ae0461b9aaeecaf30438 (patch)
treef44a1c436b5d70d7ef60ddc783733dbbd4824998
parent99ec957948ce3af0c40e9cb1560e2de59fbc8912 (diff)
cid#1448518: Resource leak (test/xmltesttools)
Change-Id: I7894b65e2b20ce94d53a7ca04eb229347145686c Reviewed-on: https://gerrit.libreoffice.org/75097 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--test/source/xmltesttools.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 42eeddc12bc3..4b0ba89de7d4 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -127,16 +127,29 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
return s;
}
case XPATH_BOOLEAN:
- return pXmlObj->boolval ? OUString("true") : OUString("false");
+ {
+ auto boolVal = pXmlObj->boolval;
+ xmlXPathFreeObject(pXmlObj);
+ return boolVal ? OUString("true") : OUString("false");
+ }
case XPATH_NUMBER:
- return OUString::number(pXmlObj->floatval);
+ {
+ auto floatVal = pXmlObj->floatval;
+ xmlXPathFreeObject(pXmlObj);
+ return OUString::number(floatVal);
+ }
case XPATH_STRING:
- return convert(pXmlObj->stringval);
+ {
+ auto convertedVal = convert(pXmlObj->stringval);
+ xmlXPathFreeObject(pXmlObj);
+ return convertedVal;
+ }
case XPATH_POINT:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
case XPATH_USERS:
case XPATH_XSLT_TREE:
+ xmlXPathFreeObject(pXmlObj);
CPPUNIT_FAIL("Unsupported XPath type");
}