From fc8b8033c645bb94484c51ddad4ed82add0cf6bc Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Fri, 21 Mar 2014 19:16:11 +0900 Subject: Avoid possible resource leaks by boost::scoped_array Change-Id: I4287fa05e35c132fb6e11d95dd17c3d3bf29defc --- svl/source/items/poolio.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'svl/source/items/poolio.cxx') diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index 90d952ad76de..7f2dc56bd1a1 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -28,6 +28,7 @@ #include #include #include "poolio.hxx" +#include // STATIC DATA ----------------------------------------------------------- @@ -762,10 +763,10 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_SIZES ); sal_uInt32 nSizeTableLen(0); rStream.ReadUInt32( nSizeTableLen ); - sal_Char *pBuf = new sal_Char[nSizeTableLen]; - rStream.Read( pBuf, nSizeTableLen ); + boost::scoped_array pBuf(new sal_Char[nSizeTableLen]); + rStream.Read( pBuf.get(), nSizeTableLen ); sal_uLong nEndOfSizes = rStream.Tell(); - SvMemoryStream aSizeTable( pBuf, nSizeTableLen, STREAM_READ ); + SvMemoryStream aSizeTable( pBuf.get(), nSizeTableLen, STREAM_READ ); // ab Version 1.3 steht in der Size-Table eine Versions-Map if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 3 ) @@ -968,7 +969,7 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) rStream.Seek( nPos + nSize ); } - delete[] pBuf; + pBuf.reset(); rStream.Seek(nEndOfSizes); CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); -- cgit