[PATCH] ws2_32: close the dest socket (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun May 26 07:33:25 CDT 2013


CID 731828

socket/handle leak is probably worse then memleak, so fix even if its
just a testcase.

Ciao, Marcus
---
 dlls/ws2_32/tests/sock.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 804c66b..4612116 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -4176,6 +4176,8 @@ static void test_WSARecv(void)
     todo_wine ok(!bret && (GetLastError() == ERROR_NETNAME_DELETED || broken(GetLastError() == ERROR_IO_INCOMPLETE) /* win9x */),
         "Did not get disconnect event: %d, error %d\n", bret, GetLastError());
     ok(bytesReturned == 0, "Bytes received is %d\n", bytesReturned);
+    closesocket(dest);
+    dest = INVALID_SOCKET;
 
     src = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0);
     ok(src != INVALID_SOCKET, "failed to create socket %d\n", WSAGetLastError());
-- 
1.7.10.4




More information about the wine-patches mailing list