Hans Leidekker : wbemprox: Return a BSTR from get_stringvalue.
Module: wine Branch: master Commit: 283db88d78ee6cf534ff4b819e2fff6a347d9b67 URL: http://source.winehq.org/git/wine.git/?a=commit;h=283db88d78ee6cf534ff4b819e... Author: Hans Leidekker <hans(a)codeweavers.com> Date: Thu May 2 12:03:02 2013 +0200 wbemprox: Return a BSTR from get_stringvalue. --- dlls/wbemprox/reg.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/wbemprox/reg.c b/dlls/wbemprox/reg.c index b4731fe..bcb9fe3 100644 --- a/dlls/wbemprox/reg.c +++ b/dlls/wbemprox/reg.c @@ -270,24 +270,24 @@ done: static HRESULT get_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval ) { HRESULT hr = S_OK; - WCHAR *buf = NULL; + BSTR str = NULL; DWORD size; LONG res; TRACE("%p, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name)); if ((res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, NULL, &size ))) goto done; - if (!(buf = heap_alloc( size ))) + if (!(str = SysAllocStringLen( NULL, size / sizeof(WCHAR) - 1 ))) { hr = E_OUTOFMEMORY; goto done; } - if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, buf, &size ))) - set_variant( VT_BSTR, 0, buf, value ); + if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, str, &size ))) + set_variant( VT_BSTR, 0, str, value ); done: set_variant( VT_UI4, res, NULL, retval ); - heap_free( buf ); + if (res) SysFreeString( str ); return hr; }
participants (1)
-
Alexandre Julliard