diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-03-28 19:17:53 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-03-28 19:20:53 +0900 |
commit | e3bd2ee4e00185d6e0e57aba7046634142d614b8 (patch) | |
tree | 02694526f8417518eabb5a2d2ddb22ed0faabb50 /desktop | |
parent | 8b533d84f3ae211fdfafc2adc8d8567f366771d4 (diff) |
Avoid possible resource leaks by boost::scoped_array
Change-Id: Ie20fc857f19f74aaccb546f9bfa11a7a657d3e8a
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 962021e91b7b..7c1d5d6a6645 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -43,6 +43,7 @@ #include <osl/file.hxx> #include <rtl/process.h> #include "tools/getprocessworkingdir.hxx" +#include <boost/scoped_array.hpp> using namespace desktop; using namespace ::com::sun::star::uno; @@ -261,11 +262,11 @@ OUString CreateMD5FromString( const OUString& aMsg ) const sal_uInt8* pData = (const sal_uInt8*)aMsg.getStr(); sal_uInt32 nSize = ( aMsg.getLength() * sizeof( sal_Unicode )); sal_uInt32 nMD5KeyLen = rtl_digest_queryLength( handle ); - sal_uInt8* pMD5KeyBuffer = new sal_uInt8[ nMD5KeyLen ]; + boost::scoped_array<sal_uInt8> pMD5KeyBuffer(new sal_uInt8[ nMD5KeyLen ]); rtl_digest_init( handle, pData, nSize ); rtl_digest_update( handle, pData, nSize ); - rtl_digest_get( handle, pMD5KeyBuffer, nMD5KeyLen ); + rtl_digest_get( handle, pMD5KeyBuffer.get(), nMD5KeyLen ); rtl_digest_destroy( handle ); // Create hex-value string from the MD5 value to keep the string size minimal @@ -273,7 +274,6 @@ OUString CreateMD5FromString( const OUString& aMsg ) for ( sal_uInt32 i = 0; i < nMD5KeyLen; i++ ) aBuffer.append( (sal_Int32)pMD5KeyBuffer[i], 16 ); - delete [] pMD5KeyBuffer; return aBuffer.makeStringAndClear(); } |