aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-10-17 12:24:51 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-10-17 12:24:51 +0000
commitdb0e3cc60ca1562f7f913b61846ffff519f4806a (patch)
treee5a7860f87a36d7c9bdb66769564acdc5a1a51ef /lib
parent8dd6a4e369aa5825cfb935001b22414e9368face (diff)
call Curl_done() in Curl_perform() after Transfer() was called, even it it
returned an error as there might be stuff in there we must free/cleanup. This fixes the memory leak Yanick Pelletier posted about 16 Oct 2001
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 80a2a75f9..90033a7bf 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -926,6 +926,8 @@ CURLcode Curl_perform(struct SessionHandle *data)
if(res == CURLE_OK) {
res = Curl_do(conn);
if(res == CURLE_OK) {
+ CURLcode res2; /* just a local extra result container */
+
if(conn->protocol&PROT_FTPS)
/* FTPS, disable ssl while transfering data */
conn->ssl.use = FALSE;
@@ -934,15 +936,19 @@ CURLcode Curl_perform(struct SessionHandle *data)
/* FTPS, enable ssl again after havving transferred data */
conn->ssl.use = TRUE;
- if(res == CURLE_OK) {
+ if(res == CURLE_OK)
/*
* We must duplicate the new URL here as the connection data
* may be free()ed in the Curl_done() function.
*/
newurl = conn->newurl?strdup(conn->newurl):NULL;
- res = Curl_done(conn);
- }
+ /* Always run Curl_done(), even if some of the previous calls
+ failed, but return the previous (original) error code */
+ res2 = Curl_done(conn);
+
+ if(CURLE_OK == res)
+ res = res2;
}
/*