[Libreoffice-commits] core.git: unotools/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Oct 31 06:33:17 UTC 2018
unotools/source/ucbhelper/ucblockbytes.cxx | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit a3d31cabe0157b2fc42c20cf5229777a9a593128
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Oct 29 14:30:28 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 31 07:32:49 2018 +0100
loplugin:useuniqueptr in UcbLockBytes::SetSize
Change-Id: Ie968bedac6abb8f76705e30eaaebb74fed949883
Reviewed-on: https://gerrit.libreoffice.org/62655
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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;
}
More information about the Libreoffice-commits
mailing list