mirror of
https://github.com/moparisthebest/curl
synced 2024-11-15 22:15:13 -05:00
imap: Fixed memory leak when performing multiple selects
Moved the clean-up of the mailbox variable from imap_disconnect() to imap_done() as this variable is allocated in the do phase, yet would have only been freed only once if multiple selects where preformed on a single connection.
This commit is contained in:
parent
6b7cf6c72d
commit
65644b8335
@ -1457,6 +1457,7 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
struct FTP *imap = data->state.proto.imap;
|
struct FTP *imap = data->state.proto.imap;
|
||||||
|
struct imap_conn *imapc= &conn->proto.imapc;
|
||||||
|
|
||||||
(void)premature;
|
(void)premature;
|
||||||
|
|
||||||
@ -1473,6 +1474,9 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status,
|
|||||||
result = status; /* use the already set error code */
|
result = status; /* use the already set error code */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cleanup our per-request based variables */
|
||||||
|
Curl_safefree(imapc->mailbox);
|
||||||
|
|
||||||
/* Clear the transfer mode for the next connection */
|
/* Clear the transfer mode for the next connection */
|
||||||
imap->transfer = FTPTRANSFER_BODY;
|
imap->transfer = FTPTRANSFER_BODY;
|
||||||
|
|
||||||
@ -1604,9 +1608,6 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)
|
|||||||
/* Cleanup the SASL module */
|
/* Cleanup the SASL module */
|
||||||
Curl_sasl_cleanup(conn, imapc->authused);
|
Curl_sasl_cleanup(conn, imapc->authused);
|
||||||
|
|
||||||
/* Cleanup our connection based variables */
|
|
||||||
Curl_safefree(imapc->mailbox);
|
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user