Commit 9a14d5d0 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Use the right allocator for BSTR values in get_owner.

parent 8e1aa435
...@@ -40,14 +40,14 @@ static HRESULT get_owner( VARIANT *user, VARIANT *domain, VARIANT *retval ) ...@@ -40,14 +40,14 @@ static HRESULT get_owner( VARIANT *user, VARIANT *domain, VARIANT *retval )
len = 0; len = 0;
GetUserNameW( NULL, &len ); GetUserNameW( NULL, &len );
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done; if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
if (!(V_BSTR( user ) = heap_alloc( len * sizeof(WCHAR) ))) goto done; if (!(V_BSTR( user ) = SysAllocStringLen( NULL, len - 1 ))) goto done;
if (!GetUserNameW( V_BSTR( user ), &len )) goto done; if (!GetUserNameW( V_BSTR( user ), &len )) goto done;
V_VT( user ) = VT_BSTR; V_VT( user ) = VT_BSTR;
len = 0; len = 0;
GetComputerNameW( NULL, &len ); GetComputerNameW( NULL, &len );
if (GetLastError() != ERROR_BUFFER_OVERFLOW) goto done; if (GetLastError() != ERROR_BUFFER_OVERFLOW) goto done;
if (!(V_BSTR( domain ) = heap_alloc( len * sizeof(WCHAR) ))) goto done; if (!(V_BSTR( domain ) = SysAllocStringLen( NULL, len - 1 ))) goto done;
if (!GetComputerNameW( V_BSTR( domain ), &len )) goto done; if (!GetComputerNameW( V_BSTR( domain ), &len )) goto done;
V_VT( domain ) = VT_BSTR; V_VT( domain ) = VT_BSTR;
......
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