From ec6eaa58addf0d8823f8c56d4ec168ff389da8c5 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 5 May 2020 19:10:16 +0200 Subject: 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 --- emfio/qa/cppunit/emf/EmfImportTest.cxx | 10 +++++----- emfio/qa/cppunit/wmf/wmfimporttest.cxx | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'emfio/qa/cppunit') diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx index 636216a79fc2..ac435905d570 100644 --- a/emfio/qa/cppunit/emf/EmfImportTest.cxx +++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx @@ -77,7 +77,7 @@ Primitive2DSequence Test::parseEmf(const OUString& aSource) void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive) { drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(rPrimitive)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(rPrimitive)); CPPUNIT_ASSERT (pDocument); @@ -104,7 +104,7 @@ void Test::TestDrawString() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawString.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); CPPUNIT_ASSERT (pDocument); // check correct import of the DrawString: height, position, text, color and font @@ -126,7 +126,7 @@ void Test::TestDrawStringTransparent() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/metafile/transform/mask/transform/unifiedtransparence", "transparence", "0.498039215686275"); @@ -149,7 +149,7 @@ void Test::TestDrawLine() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestDrawLine.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); CPPUNIT_ASSERT (pDocument); // check correct import of the DrawLine: color and width of the line @@ -163,7 +163,7 @@ void Test::TestLinearGradient() Primitive2DSequence aSequence = parseEmf("/emfio/qa/cppunit/emf/data/TestLinearGradient.emf"); CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); drawinglayer::tools::Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); CPPUNIT_ASSERT (pDocument); assertXPath(pDocument, "/primitive2D/metafile/transform", "xy11", "1.0000656512605"); diff --git a/emfio/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx index 5d3c3b772de5..5dfcfdad2041 100644 --- a/emfio/qa/cppunit/wmf/wmfimporttest.cxx +++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx @@ -73,7 +73,7 @@ void WmfTest::testNonPlaceableWmf() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::POLYLINE, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -102,7 +102,7 @@ void WmfTest::testSine() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -118,7 +118,7 @@ void WmfTest::testEmfProblem() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::ISECTRECTCLIPREGION, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -138,7 +138,7 @@ void WmfTest::testEmfLineStyles() dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::LINE, false); dumper.filterActionType(MetaActionType::LINECOLOR, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -197,7 +197,7 @@ void WmfTest::testWorldTransformFontSize() MetafileXmlDump dumper; dumper.filterAllActionTypes(); dumper.filterActionType(MetaActionType::FONT, false); - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -225,7 +225,7 @@ void WmfTest::testTdf93750() ReadWindowMetafile(aFileStream, aGDIMetaFile); MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -264,7 +264,7 @@ void WmfTest::testTdf39894() ReadWindowMetafile(aFileStream, aGDIMetaFile); MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); @@ -285,7 +285,7 @@ void WmfTest::testETO_PDY() ReadWindowMetafile(aFileStream, aGDIMetaFile); MetafileXmlDump dumper; - xmlDocPtr pDoc = dumpAndParse(dumper, aGDIMetaFile); + xmlDocUniquePtr pDoc = dumpAndParse(dumper, aGDIMetaFile); CPPUNIT_ASSERT(pDoc); -- cgit