mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-10 21:40:29 +00:00
apps/smtp: Fix memory leak if SMTP_BODYDH_MALLOC fails
Need to free s before return error. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
This commit is contained in:
parent
5bbe190b3b
commit
ae210967f2
@ -1447,6 +1447,7 @@ smtp_send_mail_bodycback(const char *from, const char* to, const char* subject,
|
|||||||
memset(s, 0, sizeof(struct smtp_session));
|
memset(s, 0, sizeof(struct smtp_session));
|
||||||
s->bodydh = (struct smtp_bodydh_state*)SMTP_BODYDH_MALLOC(sizeof(struct smtp_bodydh_state));
|
s->bodydh = (struct smtp_bodydh_state*)SMTP_BODYDH_MALLOC(sizeof(struct smtp_bodydh_state));
|
||||||
if (s->bodydh == NULL) {
|
if (s->bodydh == NULL) {
|
||||||
|
SMTP_STATE_FREE(s);
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
memset(s->bodydh, 0, sizeof(struct smtp_bodydh));
|
memset(s->bodydh, 0, sizeof(struct smtp_bodydh));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user