apps/smtp: Fix memory leak in smtp_send_mail_alloced error paths

Call smtp_free_struct(s) in all smtp_send_mail_alloced error paths to ensure
no memory leak.

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Dirk Ziegelmeier <[email protected]>
This commit is contained in:
Axel Lin
2017-05-11 10:47:20 +02:00
committed by Dirk Ziegelmeier
parent ec9096be40
commit 9dee346000
+8 -4
View File
@@ -483,20 +483,24 @@ smtp_send_mail_alloced(struct smtp_session *s)
* - only 7-bit ASCII is allowed
*/
if (smtp_verify(s->to, s->to_len, 0) != ERR_OK) {
return ERR_ARG;
err = ERR_ARG;
goto leave;
}
if (smtp_verify(s->from, s->from_len, 0) != ERR_OK) {
return ERR_ARG;
err = ERR_ARG;
goto leave;
}
if (smtp_verify(s->subject, s->subject_len, 0) != ERR_OK) {
return ERR_ARG;
err = ERR_ARG;
goto leave;
}
#if SMTP_BODYDH
if (s->bodydh == NULL)
#endif /* SMTP_BODYDH */
{
if (smtp_verify(s->body, s->body_len, 0) != ERR_OK) {
return ERR_ARG;
err = ERR_ARG;
goto leave;
}
}
#endif /* SMTP_CHECK_DATA */