aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-12 22:04:25 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-12 22:04:25 +0000
commit407583e8e275fdfb339c98086d431685024fef90 (patch)
treee6cef0b9563b89af7504ef9c9fd884a27067d731 /lib/transfer.c
parent131645dc310a70d8d8ca1df00ec7329bc80c940e (diff)
Moved the secondarysocket cleanup. The 'conn' struct may have been cleared
already at that other place.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 6e0b9e6c7..893897b05 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1188,12 +1188,20 @@ CURLcode Curl_perform(struct SessionHandle *data)
* may be free()ed in the Curl_done() function.
*/
newurl = conn->newurl?strdup(conn->newurl):NULL;
- else
+ else {
/* The transfer phase returned error, we mark the connection to get
* closed to prevent being re-used. This is becasue we can't
* possibly know if the connection is in a good shape or not now. */
conn->bits.close = TRUE;
+ if(-1 !=conn->secondarysocket) {
+ /* if we failed anywhere, we must clean up the secondary socket if
+ it was used */
+ sclose(conn->secondarysocket);
+ conn->secondarysocket=-1;
+ }
+ }
+
/* Always run Curl_done(), even if some of the previous calls
failed, but return the previous (original) error code */
res2 = Curl_done(conn);
@@ -1414,13 +1422,6 @@ 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;
}