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

This commit is contained in:
Hans Leidekker 2013-06-04 13:27:08 +02:00 committed by Alexandre Julliard
parent 8e1aa4358a
commit 9a14d5d024
1 changed files with 2 additions and 2 deletions

View File

@ -40,14 +40,14 @@ static HRESULT get_owner( VARIANT *user, VARIANT *domain, VARIANT *retval )
len = 0;
GetUserNameW( NULL, &len );
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;
V_VT( user ) = VT_BSTR;
len = 0;
GetComputerNameW( NULL, &len );
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;
V_VT( domain ) = VT_BSTR;