mirror of https://github.com/moparisthebest/curl
smtp_done: free data before returning (on send failure)
... as otherwise it could leak that memory. Detected by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3600 Assisted-by: Max Dymond Closes #1977
This commit is contained in:
parent
ecf21c551f
commit
38ab7b4ccb
|
@ -1188,6 +1188,9 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
|
||||||
if(!smtp || !pp->conn)
|
if(!smtp || !pp->conn)
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
|
||||||
|
/* Cleanup our per-request based variables */
|
||||||
|
Curl_safefree(smtp->custom);
|
||||||
|
|
||||||
if(status) {
|
if(status) {
|
||||||
connclose(conn, "SMTP done with bad status"); /* marked for closure */
|
connclose(conn, "SMTP done with bad status"); /* marked for closure */
|
||||||
result = status; /* use the already set error code */
|
result = status; /* use the already set error code */
|
||||||
|
@ -1246,9 +1249,6 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
|
||||||
result = smtp_block_statemach(conn);
|
result = smtp_block_statemach(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup our per-request based variables */
|
|
||||||
Curl_safefree(smtp->custom);
|
|
||||||
|
|
||||||
/* Clear the transfer mode for the next request */
|
/* Clear the transfer mode for the next request */
|
||||||
smtp->transfer = FTPTRANSFER_BODY;
|
smtp->transfer = FTPTRANSFER_BODY;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue