summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-29 14:30:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-31 07:32:49 +0100
commita3d31cabe0157b2fc42c20cf5229777a9a593128 (patch)
treea6b567e993a444030980e7b356fde6bcced549b1 /unotools
parentc2ce64682155815b433a5a1c380e041caf6c4028 (diff)
loplugin:useuniqueptr in UcbLockBytes::SetSize
Change-Id: Ie968bedac6abb8f76705e30eaaebb74fed949883 Reviewed-on: https://gerrit.libreoffice.org/62655 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 04bb3225a515..011a083de4cd 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -1238,10 +1238,9 @@ ErrCode UcbLockBytes::SetSize (sal_uInt64 const nNewSize)
if ( nSize < nNewSize )
{
std::size_t nDiff = nNewSize-nSize, nCount=0;
- sal_uInt8* pBuffer = new sal_uInt8[ nDiff ];
- memset(pBuffer, 0, nDiff); // initialize for enhanced security
- WriteAt( nSize, pBuffer, nDiff, &nCount );
- delete[] pBuffer;
+ std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[ nDiff ]);
+ memset(pBuffer.get(), 0, nDiff); // initialize for enhanced security
+ WriteAt( nSize, pBuffer.get(), nDiff, &nCount );
if ( nCount != nDiff )
return ERRCODE_IO_CANTWRITE;
}