summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-06 09:46:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-06 09:22:46 +0000
commitaa09b0c27a6d925da428d6267daadc7338829869 (patch)
treeb0fa576ff64820061d9fb876bebacd23e58ddc56 /sd
parent0c82dff153d92150729815b919854a9a350aa031 (diff)
loplugin:useuniqueptr extend to catch more localvar cases
i.e. where the code looks like { foo * p = new foo; ... delete p; return ...; } Change-Id: Id5f2e55d0363fc62c72535a23faeaaf1f0ac6aee Reviewed-on: https://gerrit.libreoffice.org/36190 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/unoidl/unosrch.cxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index cd59a07b3dd5..a24f235ecde6 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -469,13 +469,13 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno::
const sal_Int32 nTextLen = aText.getLength();
- sal_Int32* pConvertPos = new sal_Int32[nTextLen+2];
- sal_Int32* pConvertPara = new sal_Int32[nTextLen+2];
+ std::unique_ptr<sal_Int32[]> pConvertPos( new sal_Int32[nTextLen+2] );
+ std::unique_ptr<sal_Int32[]> pConvertPara( new sal_Int32[nTextLen+2] );
const sal_Unicode* pText = aText.getStr();
- sal_Int32* pPos = pConvertPos;
- sal_Int32* pPara = pConvertPara;
+ sal_Int32* pPos = pConvertPos.get();
+ sal_Int32* pPara = pConvertPara.get();
sal_Int32 nLastPos = 0, nLastPara = 0;
@@ -614,9 +614,6 @@ uno::Reference< text::XTextRange > SdUnoSearchReplaceShape::Search( const uno::
}
}
- delete[] pConvertPos;
- delete[] pConvertPara;
-
return xFound;
}