From acde273ea8b105ed5cc7adec98110b822a1b4490 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 11 Jul 2018 17:14:09 +0200 Subject: return SvMemoryStream by std::unique_ptr Change-Id: I60a41111e76d72a7384cbb15f2d2a73c95af8c2d Reviewed-on: https://gerrit.libreoffice.org/57280 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sot/source/sdstor/storage.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sot') diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 3848fd941585..85279dec46cc 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -456,10 +456,9 @@ SotStorage::~SotStorage() delete m_pStorStm; } -SvMemoryStream * SotStorage::CreateMemoryStream() +std::unique_ptr SotStorage::CreateMemoryStream() { - SvMemoryStream * pStm = nullptr; - pStm = new SvMemoryStream( 0x8000, 0x8000 ); + std::unique_ptr pStm(new SvMemoryStream( 0x8000, 0x8000 )); tools::SvRef aStg = new SotStorage( *pStm ); if( CopyTo( aStg.get() ) ) { @@ -468,8 +467,7 @@ SvMemoryStream * SotStorage::CreateMemoryStream() else { aStg.clear(); // release storage beforehand - delete pStm; - pStm = nullptr; + pStm.reset(); } return pStm; } -- cgit