summaryrefslogtreecommitdiff
path: root/chart2/qa/extras/xshape
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-05 19:10:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-07 09:52:27 +0200
commitec6eaa58addf0d8823f8c56d4ec168ff389da8c5 (patch)
treeadb44639fc6bdecad5f576aa5e1aa90f3c9d64b3 /chart2/qa/extras/xshape
parentc437948f6c0d602bb200fc92e80cb73ae8ae5109 (diff)
fix memory leak of xmlDoc objects
in unit tests Change-Id: Id16731bbbe2f1b0e3642722d77aba04fc98db4cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93508 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/qa/extras/xshape')
-rw-r--r--chart2/qa/extras/xshape/chart2xshape.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx
index e68deadc2294..a4f24e666691 100644
--- a/chart2/qa/extras/xshape/chart2xshape.cxx
+++ b/chart2/qa/extras/xshape/chart2xshape.cxx
@@ -48,7 +48,7 @@ private:
void compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference = false);
OUString getXShapeDumpString();
- xmlDocPtr getXShapeDumpXmlDoc();
+ xmlDocUniquePtr getXShapeDumpXmlDoc();
};
namespace {
@@ -73,11 +73,11 @@ OUString Chart2XShapeTest::getXShapeDumpString()
return xDumper->dump();
}
-xmlDocPtr Chart2XShapeTest::getXShapeDumpXmlDoc()
+xmlDocUniquePtr Chart2XShapeTest::getXShapeDumpXmlDoc()
{
OUString rDump = getXShapeDumpString();
OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8);
- return xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr()));
+ return xmlDocUniquePtr(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr())));
}
void Chart2XShapeTest::compareAgainstReference(const OUString& rReferenceFile, bool bCreateReference)
@@ -173,7 +173,7 @@ void Chart2XShapeTest::testTdf76649TrendLineBug()
load("chart2/qa/extras/xshape/data/ods/", "tdf76649_TrendLineBug.ods");
- xmlDocPtr pXmlDoc = getXShapeDumpXmlDoc();
+ xmlDocUniquePtr pXmlDoc = getXShapeDumpXmlDoc();
// Check if the regression curve exists (which means a XShape with a certain
// name should exist in the dump)
@@ -187,7 +187,7 @@ void Chart2XShapeTest::testTdf88154LabelRotatedLayout()
uno::Reference< qa::XDumper > xDumper( xChartDoc, UNO_QUERY_THROW );
OUString rDump = xDumper->dump();
OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8);
- xmlDocPtr pXmlDoc = xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr()));
+ xmlDocUniquePtr pXmlDoc(xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr())));
{
OString aPath( "//XShape[@text='Oct-12']/Transformation" );