aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-10 12:34:04 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-10 12:34:04 +0000
commitd8667165652cc69425b6f558460e3053881f46fa (patch)
tree5c36bbfd8082265387267af813c83bc994f16fed /lib
parent307d0effe285588fa98d8f4e462c92be583fb401 (diff)
Gautam Mani found a socket descriptor leak that happened when FTP transfers
failed and you reinvoked curl_easy_perform().
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index dac5dee96..6e0b9e6c7 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1414,6 +1414,13 @@ CURLcode Curl_perform(struct SessionHandle *data)
if(!res && res2)
res = res2;
+ if(conn && (-1 !=conn->secondarysocket)) {
+ /* if we failed anywhere, we must clean up the secondary socket if it
+ was used */
+ sclose(conn->secondarysocket);
+ conn->secondarysocket=-1;
+ }
+
return res;
}