From 176981b529bad6a61ad4a5439c87953ae5541a98 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 17 Feb 2005 14:45:03 +0000 Subject: [PATCH] close the socket properly when returning error due to failing localbind Bug report #1124588 by David --- lib/connect.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/connect.c b/lib/connect.c index e59e6721e..261ab08d8 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -640,8 +640,10 @@ singleipconnect(struct connectdata *conn, /* user selected to bind the outgoing socket to a specified "device" before doing connect */ CURLcode res = bindlocal(conn, sockfd); - if(res) + if(res) { + sclose(sockfd); /* close socket and bail out */ return res; + } } /* set socket non-blocking */