summaryrefslogtreecommitdiffstats
path: root/registry
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-07-26 10:48:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-07-26 16:26:18 +0200
commitd9f81ecb1f8a6142379d85a7c6b1fdb54c57ad22 (patch)
treede623be49dec6a1cba6e8078c39741baba6c7bf3 /registry
parentucb: avoid -Werror=deprecated-copy (GCC trunk towards GCC 9) (diff)
downloadcore-d9f81ecb1f8a6142379d85a7c6b1fdb54c57ad22.tar.gz
core-d9f81ecb1f8a6142379d85a7c6b1fdb54c57ad22.zip
Related: rhbz#1602589 silence error[memleak]: Memory leak: newValue
Change-Id: I2d04c75aa9b5e1d91e06992fdb99899657ecf96d Reviewed-on: https://gerrit.libreoffice.org/58062 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'registry')
-rw-r--r--registry/source/reflwrit.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index 53b6d9d0e175..dc3e2a15b603 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -377,11 +377,11 @@ void FieldEntry::setData(const OString& name,
RTValueType constValueType,
RTConstValueUnion constValue)
{
- sal_Unicode * newValue = nullptr;
+ std::unique_ptr<sal_Unicode[]> newValue;
if (constValueType == RT_TYPE_STRING && constValue.aString != nullptr) {
sal_Int32 n = rtl_ustr_getLength(constValue.aString) + 1;
- newValue = new sal_Unicode[n];
- memcpy(newValue, constValue.aString, n * sizeof (sal_Unicode));
+ newValue.reset(new sal_Unicode[n]);
+ memcpy(newValue.get(), constValue.aString, n * sizeof (sal_Unicode));
}
m_name = name;
@@ -407,7 +407,7 @@ void FieldEntry::setData(const OString& name,
m_constValue.aString = NULL_WSTRING;
else
{
- m_constValue.aString = newValue;
+ m_constValue.aString = newValue.release();
}
}
else