diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-16 16:12:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-16 20:45:33 +0200 |
commit | 203288c830041b41268f23b9aed5ad786a8e7ae6 (patch) | |
tree | d4c983405c3df00f4666979c5fc40fbae22924b8 /sc/source/ui/unoobj/datauno.cxx | |
parent | a0796ca91174e317cdf280a35fb6a5dad2aef66f (diff) |
fix leak in ScSubTotalParam
Change-Id: If839585931fc90b9910f6b95338d59ba48a1a78f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115676
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj/datauno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/datauno.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 4691b7082326..d1c1f55bc1a1 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -507,8 +507,8 @@ void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns( aParam.nSubTotals[nPos] = nCount; if (nCount != 0) { - aParam.pSubTotals[nPos] = new SCCOL[nCount]; - aParam.pFunctions[nPos] = new ScSubTotalFunc[nCount]; + aParam.pSubTotals[nPos].reset(new SCCOL[nCount]); + aParam.pFunctions[nPos].reset(new ScSubTotalFunc[nCount]); const sheet::SubTotalColumn* pAry = aSubTotalColumns.getConstArray(); for (SCCOL i=0; i<nCount; i++) @@ -519,8 +519,8 @@ void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns( } else { - aParam.pSubTotals[nPos] = nullptr; - aParam.pFunctions[nPos] = nullptr; + aParam.pSubTotals[nPos].reset(); + aParam.pFunctions[nPos].reset(); } } //! otherwise exception or so? (too many columns) @@ -581,15 +581,15 @@ void SAL_CALL ScSubTotalDescriptorBase::addNew( aParam.bGroupActive[nPos] = true; aParam.nField[nPos] = static_cast<SCCOL>(nGroupColumn); - delete aParam.pSubTotals[nPos]; - delete aParam.pFunctions[nPos]; + aParam.pSubTotals[nPos].reset(); + aParam.pFunctions[nPos].reset(); SCCOL nCount = static_cast<SCCOL>(nColCount); aParam.nSubTotals[nPos] = nCount; if (nCount != 0) { - aParam.pSubTotals[nPos] = new SCCOL[nCount]; - aParam.pFunctions[nPos] = new ScSubTotalFunc[nCount]; + aParam.pSubTotals[nPos].reset(new SCCOL[nCount]); + aParam.pFunctions[nPos].reset(new ScSubTotalFunc[nCount]); const sheet::SubTotalColumn* pAry = aSubTotalColumns.getConstArray(); for (SCCOL i=0; i<nCount; i++) @@ -600,8 +600,8 @@ void SAL_CALL ScSubTotalDescriptorBase::addNew( } else { - aParam.pSubTotals[nPos] = nullptr; - aParam.pFunctions[nPos] = nullptr; + aParam.pSubTotals[nPos].reset(); + aParam.pFunctions[nPos].reset(); } PutData(aParam); |