summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-09 17:10:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-10 08:30:21 +0200
commit65e41592a650887c8d00586385119effa54de5fa (patch)
tree4b0f6c7f52159d9cf70c561c815f623d3b57198d /svx
parentacb7c06ab171d4201842d8183eefeeca2d28c3f5 (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 'svx')
-rw-r--r--svx/source/xml/xmlgrhlp.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 4063179e9082..553522172a27 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -111,7 +111,7 @@ GraphicInputStream::GraphicInputStream(GraphicObject const & raGraphicObject, co
if (aGraphicObject.GetType() != GraphicType::NONE)
{
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream(maTempFile.GetURL(), StreamMode::WRITE | StreamMode::TRUNC);
+ std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream(maTempFile.GetURL(), StreamMode::WRITE | StreamMode::TRUNC);
if (pStream)
{
@@ -163,10 +163,8 @@ GraphicInputStream::GraphicInputStream(GraphicObject const & raGraphicObject, co
if (bRet)
{
pStream->Seek( 0 );
- mxStreamWrapper = new ::utl::OInputStreamWrapper(pStream, true);
+ mxStreamWrapper = new ::utl::OInputStreamWrapper(std::move(pStream));
}
- else
- delete pStream;
}
}
}
@@ -250,7 +248,7 @@ SvXMLGraphicOutputStream::SvXMLGraphicOutputStream()
{
mpTmp->EnableKillingFile();
- mpOStm.reset( ::utl::UcbStreamHelper::CreateStream( mpTmp->GetURL(), StreamMode::WRITE | StreamMode::TRUNC ) );
+ mpOStm = ::utl::UcbStreamHelper::CreateStream( mpTmp->GetURL(), StreamMode::WRITE | StreamMode::TRUNC );
if( mpOStm )
mxStmWrapper = new ::utl::OOutputStreamWrapper( *mpOStm );