1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 00:58: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:
Daniel Stenberg 2020-02-28 09:49:02 +01:00
parent ea1b2eb976
commit aeb292301a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -625,6 +625,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
utf8 = TRUE;
if(host.name) {
free(from);
from = aprintf("<%s@%s>", address, host.name);
Curl_free_idnconverted_hostname(&host);
@ -635,6 +636,8 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
auth = aprintf("<%s>", address);
free(address);
if(!from)
return CURLE_OUT_OF_MEMORY;
}
else
/* Empty AUTH, RFC-2554, sect. 5 */