From e7d77fb3ef14bac8690f343327b302f866ac53f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Fri, 8 Nov 2013 00:09:20 +0100 Subject: connect: Close temporary sockets in conn_free() The temporary sockets used for Happy Eyeballs were not closed properly, if curl exited prematurely, which this patch fixes. --- lib/connect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/connect.c') diff --git a/lib/connect.c b/lib/connect.c index 2fd9883b9..67f73343c 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -758,10 +758,13 @@ CURLcode Curl_is_connected(struct connectdata *conn, /* use this socket from now on */ conn->sock[sockindex] = conn->tempsock[i]; conn->ip_addr = conn->tempaddr[i]; + conn->tempsock[i] = CURL_SOCKET_BAD; /* close the other socket, if open */ - if(conn->tempsock[other] != CURL_SOCKET_BAD) + if(conn->tempsock[other] != CURL_SOCKET_BAD) { Curl_closesocket(conn, conn->tempsock[other]); + conn->tempsock[other] = CURL_SOCKET_BAD; + } /* see if we need to do any proxy magic first once we connected */ code = Curl_connected_proxy(conn, sockindex); -- cgit v1.2.3