summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2017-09-03 06:51:34 +0900
committerJulien Nabet <serval2412@yahoo.fr>2017-09-03 07:53:55 +0200
commit77dbcb5620c1d233d09f6374927ef0c149fc8210 (patch)
treeca37cb9b2435db2db95913a9cf923ebc0f8e9daa /svx
parent5ac0a71cc17b37fcd758027ec8a0a996f4cdaf32 (diff)
svx: Fix memleak at early returns from SvxXMLXTableExportComponent::save
Change-Id: Ic6da38a47f2c2f2e350a15bad2b2731ed12409a9 Reviewed-on: https://gerrit.libreoffice.org/41853 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xml/xmlxtexp.cxx7
1 files changed, 2 insertions, 5 deletions
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
index 2cb4fc05232f..4bb2e7484709 100644
--- a/svx/source/xml/xmlxtexp.cxx
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -196,7 +196,7 @@ bool SvxXMLXTableExportComponent::save(
OUString *pOptName )
{
bool bRet = false;
- SfxMedium* pMedium = nullptr;
+ std::unique_ptr<SfxMedium> pMedium;
SvXMLGraphicHelper* pGraphicHelper = nullptr;
sal_Int32 eCreate = embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE;
@@ -227,7 +227,7 @@ bool SvxXMLXTableExportComponent::save(
xSubStorage = ::comphelper::OStorageHelper::GetStorageFromURL( rURL, eCreate );
else
{
- pMedium = new SfxMedium( rURL, StreamMode::WRITE | StreamMode::TRUNC );
+ pMedium.reset(new SfxMedium( rURL, StreamMode::WRITE | StreamMode::TRUNC ));
SvStream* pStream = pMedium->GetOutStream();
if( !pStream )
@@ -305,10 +305,7 @@ bool SvxXMLXTableExportComponent::save(
}
if( pMedium )
- {
pMedium->Commit();
- delete pMedium;
- }
return bRet;
}