ws2_32: Avoid accessing uninitialized memory in GetAddrInfoW.

Found by valgrind.
This commit is contained in:
Hans Leidekker 2009-10-29 11:11:38 +01:00 committed by Alexandre Julliard
parent 5e18596fc5
commit 140eede67d

View file

@ -3962,6 +3962,8 @@ int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hin
char *nodenameA, *servnameA = NULL;
struct WS_addrinfo *resA, *hintsA = NULL;
if (!nodename) return WSAHOST_NOT_FOUND;
len = WideCharToMultiByte(CP_ACP, 0, nodename, -1, NULL, 0, NULL, NULL);
if (!(nodenameA = HeapAlloc(GetProcessHeap(), 0, len))) return EAI_MEMORY;
WideCharToMultiByte(CP_ACP, 0, nodename, -1, nodenameA, len, NULL, NULL);