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

Alexandre Julliard julliard at winehq.org
Tue Jun 4 15:48:35 CDT 2013


Module: wine
Branch: master
Commit: 9a14d5d024ec4f95663b74a0e8a5c1e5a571f651
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9a14d5d024ec4f95663b74a0e8a5c1e5a571f651

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Jun  4 13:27:08 2013 +0200

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

---

 dlls/wbemprox/process.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wbemprox/process.c b/dlls/wbemprox/process.c
index 918ba91..d3552b7 100644
--- a/dlls/wbemprox/process.c
+++ b/dlls/wbemprox/process.c
@@ -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;
 




More information about the wine-cvs mailing list