summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-02-17 14:45:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-02-17 14:45:03 +0000
commit176981b529bad6a61ad4a5439c87953ae5541a98 (patch)
tree5fff419e8f19d78299f75b6773f6fe1a0f33f611
parent85baebd0d4369a41a5ccac6e456a07b7f5d08c2a (diff)
downloadgnurl-176981b529bad6a61ad4a5439c87953ae5541a98.tar.gz
gnurl-176981b529bad6a61ad4a5439c87953ae5541a98.tar.bz2
gnurl-176981b529bad6a61ad4a5439c87953ae5541a98.zip
close the socket properly when returning error due to failing localbind
Bug report #1124588 by David
-rw-r--r--lib/connect.c4
1 files changed, 3 insertions, 1 deletions
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 */