1
0
mirror of https://github.com/moparisthebest/curl synced 2025-01-06 19:38:05 -05:00

pop3: fixed memory leak in an error retrieval case

This commit is contained in:
Dan Fandrich 2011-03-17 16:28:12 -07:00
parent 929aeed386
commit 409867e62b

View File

@ -690,6 +690,7 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status,
{ {
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
struct FTP *pop3 = data->state.proto.pop3; struct FTP *pop3 = data->state.proto.pop3;
struct pop3_conn *pop3c = &conn->proto.pop3c;
CURLcode result=CURLE_OK; CURLcode result=CURLE_OK;
(void)premature; (void)premature;
@ -706,6 +707,9 @@ static CURLcode pop3_done(struct connectdata *conn, CURLcode status,
result = status; /* use the already set error code */ result = status; /* use the already set error code */
} }
free(pop3c->mailbox);
pop3c->mailbox = NULL;
/* clear these for next connection */ /* clear these for next connection */
pop3->transfer = FTPTRANSFER_BODY; pop3->transfer = FTPTRANSFER_BODY;
@ -884,8 +888,6 @@ static CURLcode pop3_dophase_done(struct connectdata *conn,
/* no data to transfer */ /* no data to transfer */
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
free(pop3c->mailbox);
return CURLE_OK; return CURLE_OK;
} }