From 65e41592a650887c8d00586385119effa54de5fa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 9 Jul 2018 17:10:49 +0200 Subject: 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 --- sw/source/filter/xml/wrtxml.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sw/source/filter/xml/wrtxml.cxx') 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 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& ) { -- cgit