aboutsummaryrefslogtreecommitdiff
path: root/lib/url.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/url.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/url.c')
-rw-r--r--lib/url.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 35b8a6c6e..36bd46455 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2503,6 +2503,10 @@ static void conn_free(struct connectdata *conn)
Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]);
if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET])
Curl_closesocket(conn, conn->sock[FIRSTSOCKET]);
+ if(CURL_SOCKET_BAD != conn->tempsock[0])
+ Curl_closesocket(conn, conn->tempsock[0]);
+ if(CURL_SOCKET_BAD != conn->tempsock[1])
+ Curl_closesocket(conn, conn->tempsock[1]);
#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED)
Curl_ntlm_wb_cleanup(conn);
@@ -3522,6 +3526,8 @@ static struct connectdata *allocate_conn(struct SessionHandle *data)
conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
+ conn->tempsock[0] = CURL_SOCKET_BAD; /* no file descriptor */
+ conn->tempsock[1] = CURL_SOCKET_BAD; /* no file descriptor */
conn->connection_id = -1; /* no ID */
conn->port = -1; /* unknown at this point */