aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-10-25 13:15:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-10-25 13:15:11 +0000
commit9e0882ba98feff82f4ffa1f8701cdc139bbcd0f1 (patch)
treeecd92b9ad5d6f1164afb1bed57a87d8eb86d2ed7 /lib/connect.c
parentc890149c8c144e6eb226d4ebf1723d203e1859ff (diff)
close the existing socket when trying next IP, as otherwise we leak one!
bug #1326306
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 23c192c7d..18c40f9ac 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -472,6 +472,9 @@ static bool trynextip(struct connectdata *conn,
if(sockindex != FIRSTSOCKET)
return TRUE; /* no next */
+ /* first close the failed socket */
+ sclose(conn->sock[sockindex]);
+
/* try the next address */
ai = conn->ip_addr->ai_next;