diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2014-03-24 03:09:23 +0900 |
---|---|---|
committer | Takeshi Abe <tabe@fixedpoint.jp> | 2014-03-24 03:10:18 +0900 |
commit | f516cff220895391c861adf1f4e93e280e1c3a17 (patch) | |
tree | 090c2c32ab91b27a49fb8de162e5c95faea5e6f2 /sfx2 | |
parent | 970517af3e02e6c05e4d2b44d63745e8a414bb43 (diff) |
Avoid possible resource leaks by boost::scoped_array
Change-Id: I7b72c5680d5665b3f1f720f50a2d3ea6fc0c3e39
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index b1f3440c16ff..9954f9ec1a77 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -64,7 +64,7 @@ #include <sfx2/msgpool.hxx> #include <com/sun/star/frame/XModuleManager.hpp> - +#include <boost/scoped_array.hpp> #include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; @@ -1451,7 +1451,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl } // Create a Set from the ranges - sal_uInt16 *pRanges = new sal_uInt16[rFound.size() * 2 + 1]; + boost::scoped_array<sal_uInt16> pRanges(new sal_uInt16[rFound.size() * 2 + 1]); int j = 0; sal_uInt16 i = 0; while ( i < rFound.size() ) @@ -1464,8 +1464,8 @@ SfxItemSet* SfxBindings::CreateSet_Impl pRanges[j++] = rFound[i++]->nWhichId; } pRanges[j] = 0; // terminating NULL - SfxItemSet *pSet = new SfxItemSet(rPool, pRanges); - delete [] pRanges; + SfxItemSet *pSet = new SfxItemSet(rPool, pRanges.get()); + pRanges.reset(); DBG_PROFSTOP(SfxBindingsCreateSet); return pSet; } diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 547b252bd9aa..6d927e51a351 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -74,6 +74,7 @@ #include <sfx2/request.hxx> #include "openflag.hxx" #include "querytemplate.hxx" +#include <boost/scoped_array.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -331,7 +332,7 @@ void SfxObjectShell::LoadStyles SfxStyleSheetBasePool *pMyPool = GetStyleSheetPool(); DBG_ASSERT(pMyPool, "Dest-DocumentShell ohne StyleSheetPool"); pSourcePool->SetSearchMask(SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_ALL); - Styles_Impl *pFound = new Styles_Impl[pSourcePool->Count()]; + boost::scoped_array<Styles_Impl> pFound(new Styles_Impl[pSourcePool->Count()]); sal_uInt16 nFound = 0; SfxStyleSheetBase *pSource = pSourcePool->First(); @@ -359,7 +360,6 @@ void SfxObjectShell::LoadStyles if(pFound[i].pSource->HasFollowSupport()) pFound[i].pDest->SetFollow(pFound[i].pSource->GetParent()); } - delete [] pFound; } |