[PATCH] ws2_32: Set *res = NULL for error return from WS_getaddrinfo()

Johannes Stezenbach js at sig21.net
Wed Dec 5 17:41:41 CST 2007

Set *res = NULL for error return from WS_getaddrinfo().

The Bridgit Desktop sharing client otherwise calls WS_freeaddrinfo()
on an uninitialized pointer even though WS_getaddrinfo() returned an
error, which leads to a crash in HeapFree().

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 3abb5a0..418fac7 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3458,6 +3458,7 @@ int WINAPI WS_getaddrinfo(LPCSTR nodename, LPCSTR servname, const struct WS_addr
     } else {
         result = convert_eai_u2w(result);
+        *res = NULL;
     return result;

More information about the wine-patches mailing list