close the existing socket when trying next IP, as otherwise we leak one!
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Oct 2005 13:15:11 +0000 (13:15 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 25 Oct 2005 13:15:11 +0000 (13:15 +0000)
bug #1326306

lib/connect.c

index 23c192c..18c40f9 100644 (file)
@@ -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;