[Libreoffice-commits] core.git: test/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 4 19:52:38 UTC 2019


 test/source/xmltesttools.cxx |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 9a6850ba8ef77e4ecf84ae0461b9aaeecaf30438
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Thu Jul 4 18:37:20 2019 +0200
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Thu Jul 4 21:51:50 2019 +0200

    cid#1448518: Resource leak (test/xmltesttools)
    
    Change-Id: I7894b65e2b20ce94d53a7ca04eb229347145686c
    Reviewed-on: https://gerrit.libreoffice.org/75097
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

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");
     }
 


More information about the Libreoffice-commits mailing list