diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-07-26 10:48:53 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-07-26 16:26:18 +0200 |
commit | d9f81ecb1f8a6142379d85a7c6b1fdb54c57ad22 (patch) | |
tree | de623be49dec6a1cba6e8078c39741baba6c7bf3 /registry | |
parent | a42a7a5d782baf7c8082f064b11cb2192dba07c5 (diff) |
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.cxx | 8 |
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 |