diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-02-22 23:29:33 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-02-22 23:29:33 +0000 |
commit | 65644b833532a0cedc2c92ef1fd89c7f21a97906 (patch) | |
tree | 079ef1705f5bbafc793747cf39826443c71ce3c7 | |
parent | 6b7cf6c72d954e7645938698f758c0c624dd4438 (diff) |
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.
-rw-r--r-- | lib/imap.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/imap.c b/lib/imap.c index 8525c89be..4621a8ff6 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1457,6 +1457,7 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status, CURLcode result = CURLE_OK; struct SessionHandle *data = conn->data; struct FTP *imap = data->state.proto.imap; + struct imap_conn *imapc= &conn->proto.imapc; (void)premature; @@ -1473,6 +1474,9 @@ static CURLcode imap_done(struct connectdata *conn, CURLcode status, 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 */ imap->transfer = FTPTRANSFER_BODY; @@ -1604,9 +1608,6 @@ static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection) /* Cleanup the SASL module */ Curl_sasl_cleanup(conn, imapc->authused); - /* Cleanup our connection based variables */ - Curl_safefree(imapc->mailbox); - return CURLE_OK; } |