Kaydet (Commit) d9f81ecb authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Stephan Bergmann

Related: rhbz#1602589 silence error[memleak]: Memory leak: newValue

Change-Id: I2d04c75aa9b5e1d91e06992fdb99899657ecf96d
Reviewed-on: https://gerrit.libreoffice.org/58062
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst a42a7a5d
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment