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 /sc/source/ui/dbgui | |
parent | 970517af3e02e6c05e4d2b44d63745e8a414bb43 (diff) |
Avoid possible resource leaks by boost::scoped_array
Change-Id: I7b72c5680d5665b3f1f720f50a2d3ea6fc0c3e39
Diffstat (limited to 'sc/source/ui/dbgui')
-rw-r--r-- | sc/source/ui/dbgui/tpsubt.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index a5fcd1b64c4c..85dc33b36069 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -30,7 +30,7 @@ #include "subtdlg.hxx" #include "tpsubt.hxx" - +#include <boost/scoped_array.hpp> // Subtotals group tabpage: @@ -203,8 +203,8 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo, theSubTotalData = ((const ScSubTotalItem*)pItem)->GetSubTotalData(); } - ScSubTotalFunc* pFunctions = NULL; - SCCOL* pSubTotals = NULL; + boost::scoped_array<ScSubTotalFunc> pFunctions; + boost::scoped_array<SCCOL> pSubTotals; sal_uInt16 nGroup = mpLbGroup->GetSelectEntryPos(); sal_uInt16 nEntryCount = (sal_uInt16)mpLbColumns->GetEntryCount(); sal_uInt16 nCheckCount = mpLbColumns->GetCheckedEntryCount(); @@ -222,8 +222,8 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo, { sal_uInt16 nFunction = 0; - pSubTotals = new SCCOL [nCheckCount]; - pFunctions = new ScSubTotalFunc [nCheckCount]; + pSubTotals.reset(new SCCOL [nCheckCount]); + pFunctions.reset(new ScSubTotalFunc [nCheckCount]); for ( sal_uInt16 i=0, nCheck=0; i<nEntryCount; i++ ) { @@ -238,17 +238,14 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo, } } theSubTotalData.SetSubTotals( nGroupNo, // Gruppen-Nr. - pSubTotals, - pFunctions, + pSubTotals.get(), + pFunctions.get(), nCheckCount ); // Anzahl der Array-Elemente } rArgSet.Put( ScSubTotalItem( SCITEM_SUBTDATA, &theSubTotalData ) ); - if ( pSubTotals ) delete [] pSubTotals; - if ( pFunctions ) delete [] pFunctions; - return true; } |