mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
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
This commit is contained in:
parent
8dd6a4e369
commit
db0e3cc60c
@ -926,6 +926,8 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
|||||||
if(res == CURLE_OK) {
|
if(res == CURLE_OK) {
|
||||||
res = Curl_do(conn);
|
res = Curl_do(conn);
|
||||||
if(res == CURLE_OK) {
|
if(res == CURLE_OK) {
|
||||||
|
CURLcode res2; /* just a local extra result container */
|
||||||
|
|
||||||
if(conn->protocol&PROT_FTPS)
|
if(conn->protocol&PROT_FTPS)
|
||||||
/* FTPS, disable ssl while transfering data */
|
/* FTPS, disable ssl while transfering data */
|
||||||
conn->ssl.use = FALSE;
|
conn->ssl.use = FALSE;
|
||||||
@ -934,15 +936,19 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
|||||||
/* FTPS, enable ssl again after havving transferred data */
|
/* FTPS, enable ssl again after havving transferred data */
|
||||||
conn->ssl.use = TRUE;
|
conn->ssl.use = TRUE;
|
||||||
|
|
||||||
if(res == CURLE_OK) {
|
if(res == CURLE_OK)
|
||||||
/*
|
/*
|
||||||
* We must duplicate the new URL here as the connection data
|
* We must duplicate the new URL here as the connection data
|
||||||
* may be free()ed in the Curl_done() function.
|
* may be free()ed in the Curl_done() function.
|
||||||
*/
|
*/
|
||||||
newurl = conn->newurl?strdup(conn->newurl):NULL;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user