diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-09 17:10:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-10 08:30:21 +0200 |
commit | 65e41592a650887c8d00586385119effa54de5fa (patch) | |
tree | 4b0f6c7f52159d9cf70c561c815f623d3b57198d /sw/source/filter/xml/wrtxml.cxx | |
parent | acb7c06ab171d4201842d8183eefeeca2d28c3f5 (diff) |
pass SvStream around by std::unique_ptr
and give utl::OStreamWrapper a new constructor so that it knows it is
taking ownership of the SvStream, which appears to fix several leaks
Change-Id: Idcbcca9b81a4f0345fd8b8c8a2f4e84213686a6b
Reviewed-on: https://gerrit.libreoffice.org/57187
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/xml/wrtxml.cxx')
-rw-r--r-- | sw/source/filter/xml/wrtxml.cxx | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 4700a5ce86d1..8006286146cf 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -372,7 +372,7 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS try { uno::Reference < io::XStream > xStm = xStg->openStreamElement( "layout-cache", embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ); - SvStream* pStream = utl::UcbStreamHelper::CreateStream( xStm ); + std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream( xStm ); if( !pStream->GetError() ) { uno::Reference < beans::XPropertySet > xSet( xStm, UNO_QUERY ); @@ -381,8 +381,6 @@ ErrCode SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xS xSet->setPropertyValue("MediaType", aAny2 ); m_pDoc->WriteLayoutCache( *pStream ); } - - delete pStream; } catch ( uno::Exception& ) { |