mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -05:00
smtp: overwriting 'from' leaks memory
Detected by Coverity. CID 1418139. Also, make sure to return error if the new 'from' allocation fails. Closes #4997
This commit is contained in:
parent
ea1b2eb976
commit
aeb292301a
@ -625,6 +625,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
|
|||||||
utf8 = TRUE;
|
utf8 = TRUE;
|
||||||
|
|
||||||
if(host.name) {
|
if(host.name) {
|
||||||
|
free(from);
|
||||||
from = aprintf("<%s@%s>", address, host.name);
|
from = aprintf("<%s@%s>", address, host.name);
|
||||||
|
|
||||||
Curl_free_idnconverted_hostname(&host);
|
Curl_free_idnconverted_hostname(&host);
|
||||||
@ -635,6 +636,8 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
|
|||||||
auth = aprintf("<%s>", address);
|
auth = aprintf("<%s>", address);
|
||||||
|
|
||||||
free(address);
|
free(address);
|
||||||
|
if(!from)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Empty AUTH, RFC-2554, sect. 5 */
|
/* Empty AUTH, RFC-2554, sect. 5 */
|
||||||
|
Loading…
Reference in New Issue
Block a user