summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-11 02:58:17 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-11 06:37:25 +0000
commitfb827f2a342602f7e62dbdebb638326193315eb6 (patch)
treea8cd4217fd544f55b2809073e035654e8a5375dd
parent63bb0e891e94206bbd50c657bca8661d135ef5e6 (diff)
fix a few memory leaks in the calc test framework
Change-Id: Ic32d31913f40636e2b579d46ecf287110090772b Reviewed-on: https://gerrit.libreoffice.org/23139 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/qa/unit/helper/qahelper.cxx13
1 files 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<SfxFilter> 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<utl::TempFile> 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<SfxFilter> 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();