diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-11 17:14:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-12 08:27:29 +0200 |
commit | acde273ea8b105ed5cc7adec98110b822a1b4490 (patch) | |
tree | 69348313444bffb5f0d8003e9e97b6773a422e42 /sot | |
parent | 7140644302d97869c7ea8d636123755fe04e640b (diff) |
return SvMemoryStream by std::unique_ptr
Change-Id: I60a41111e76d72a7384cbb15f2d2a73c95af8c2d
Reviewed-on: https://gerrit.libreoffice.org/57280
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/sdstor/storage.cxx | 8 |
1 files changed, 3 insertions, 5 deletions
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<SvMemoryStream> SotStorage::CreateMemoryStream() { - SvMemoryStream * pStm = nullptr; - pStm = new SvMemoryStream( 0x8000, 0x8000 ); + std::unique_ptr<SvMemoryStream> pStm(new SvMemoryStream( 0x8000, 0x8000 )); tools::SvRef<SotStorage> 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; } |