From fb827f2a342602f7e62dbdebb638326193315eb6 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 11 Mar 2016 02:58:17 +0100 Subject: fix a few memory leaks in the calc test framework Change-Id: Ic32d31913f40636e2b579d46ecf287110090772b Reviewed-on: https://gerrit.libreoffice.org/23139 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- sc/qa/unit/helper/qahelper.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index c4df244c7974..031f6bb38703 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -539,6 +539,7 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite, const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID, sal_uIntPtr nFilterVersion, const OUString* pPassword ) { + // TODO: will currently leak the pFilter instance SfxFilter* pFilter = new SfxFilter( rFilter, OUString(), nFilterFlags, nClipboardID, rTypeName, 0, OUString(), @@ -631,12 +632,12 @@ ScDocShellRef ScBootstrapFixture::saveAndReload( SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARCHART_8; - SfxFilter* pExportFilter = new SfxFilter( + std::unique_ptr pExportFilter(new SfxFilter( rFilter, OUString(), nFormatType, nExportFormat, rTypeName, 0, OUString(), - rUserData, OUString("private:factory/scalc*") ); + rUserData, OUString("private:factory/scalc*") )); pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); - aStoreMedium.SetFilter(pExportFilter); + aStoreMedium.SetFilter(pExportFilter.get()); pShell->DoSaveAs( aStoreMedium ); pShell->DoClose(); @@ -677,12 +678,12 @@ std::shared_ptr ScBootstrapFixture::exportTo( ScDocShell* pShell, SfxFilterFlags nFormatType = aFileFormats[nFormat].nFormatType; if (nFormatType == ODS_FORMAT_TYPE) nExportFormat = SotClipboardFormatId::STARCHART_8; - SfxFilter* pExportFilter = new SfxFilter( + std::unique_ptr pExportFilter(new SfxFilter( aFilterName, OUString(), nFormatType, nExportFormat, aFilterType, 0, OUString(), - OUString(), OUString("private:factory/scalc*") ); + OUString(), OUString("private:factory/scalc*") )); pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); - aStoreMedium.SetFilter(pExportFilter); + aStoreMedium.SetFilter(pExportFilter.get()); pShell->DoSaveAs( aStoreMedium ); pShell->DoClose(); -- cgit