summaryrefslogtreecommitdiff
path: root/sdext/source/pdfimport/wrapper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-10 13:36:34 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-11-11 07:16:20 +0000
commitdb17d3c17c40d6b0e92392cf3c6e343d1d17b771 (patch)
tree9d562fcf764e7717df9585ef0e735a12ea4aaa16 /sdext/source/pdfimport/wrapper
parent2ce9e4be4a438203382cb9cca824ce3e90647f3a (diff)
new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to use std::unique_ptr Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc Reviewed-on: https://gerrit.libreoffice.org/19884 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sdext/source/pdfimport/wrapper')
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 5e1584e4cfba..74e17f87c118 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -203,10 +203,10 @@ namespace
{
const size_t nOrigLen(sal::static_int_cast<size_t>(i_rStr.getLength()));
const sal_Char* const pOrig(i_rStr.getStr());
- sal_Char* const pBuffer(new sal_Char[nOrigLen + 1]);
+ std::unique_ptr<sal_Char[]> pBuffer(new sal_Char[nOrigLen + 1]);
const sal_Char* pRead(pOrig);
- sal_Char* pWrite(pBuffer);
+ sal_Char* pWrite(pBuffer.get());
const sal_Char* pCur(pOrig);
while ((pCur = strchr(pCur, '\\')) != nullptr)
{
@@ -237,8 +237,7 @@ namespace
}
*pWrite = '\0';
- OString aResult(pBuffer);
- delete[] pBuffer;
+ OString aResult(pBuffer.get());
return aResult;
}