aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjst@bjorn>2013-11-08 00:09:20 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-11-10 22:49:56 +0000
commite7d77fb3ef14bac8690f343327b302f866ac53f2 (patch)
treef6447320eb2516c46c53405718601cad61efa965 /lib/connect.c
parentc8e63f247aa14a6721b0d04f444d258e690b0dc8 (diff)
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.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c5
1 files changed, 4 insertions, 1 deletions
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);