summaryrefslogtreecommitdiff
path: root/sw/source/ui/vba/vbasystem.cxx
diff options
context:
space:
mode:
authorMatthew J. Francis <mjay.francis@gmail.com>2014-09-20 12:14:41 +0800
committerNoel Grandin <noelgrandin@gmail.com>2014-09-22 05:15:53 +0000
commit764e3016b62665281539af4e990ca4ff0445c26c (patch)
treef5ec6b10fa76e3f622d26095981e5c1a92c2485f /sw/source/ui/vba/vbasystem.cxx
parent935e8fc98c033680029e4531747a2f680f50d5ca (diff)
fdo#84086 Fix assorted use-after-free bugs
Change-Id: Iec004fffdb0afbe27bd69f379db90f6d904a8a65 Reviewed-on: https://gerrit.libreoffice.org/11553 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/ui/vba/vbasystem.cxx')
-rw-r--r--sw/source/ui/vba/vbasystem.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx
index dc95d82f2d2e..b2de217a8d2d 100644
--- a/sw/source/ui/vba/vbasystem.cxx
+++ b/sw/source/ui/vba/vbasystem.cxx
@@ -152,10 +152,10 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL );
if( ERROR_SUCCESS == lResult )
{
- LPCTSTR szValue = TEXT( OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 ).getStr() );
- DWORD cbData = sizeof(TCHAR) * (_tcslen(szValue) + 1);
+ OString aUTF8Value = OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 );
+ DWORD cbData = sizeof(TCHAR) * (_tcslen(aUTF8Value.getStr()) + 1);
LPCTSTR lpValueName = TEXT(maKey.getStr());
- lResult = RegSetValueEx( hKey, lpValueName, 0 /* Reserved */, REG_SZ, (LPBYTE)szValue, cbData );
+ lResult = RegSetValueEx( hKey, lpValueName, 0 /* Reserved */, REG_SZ, (LPBYTE)aUTF8Value.getStr(), cbData );
RegCloseKey( hKey );
}
}