From: Stephan Bosch Date: Sat, 9 Feb 2019 11:32:44 +0000 (+0100) Subject: lib-smtp: smtp-client-transaction - Free the rcpt object in smtp_client_transaction_r... X-Git-Tag: 2.3.7~111 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b869a057768cbeb042c4a6bc1074e6dc782f0a3;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: smtp-client-transaction - Free the rcpt object in smtp_client_transaction_rcpt_fail_reply(). --- diff --git a/src/lib-smtp/smtp-client-transaction.c b/src/lib-smtp/smtp-client-transaction.c index 7188f19c97..9b9c35f5e7 100644 --- a/src/lib-smtp/smtp-client-transaction.c +++ b/src/lib-smtp/smtp-client-transaction.c @@ -294,9 +294,10 @@ void smtp_client_transaction_rcpt_abort( static void smtp_client_transaction_rcpt_fail_reply( - struct smtp_client_transaction_rcpt *rcpt, + struct smtp_client_transaction_rcpt **_rcpt, const struct smtp_reply *reply) { + struct smtp_client_transaction_rcpt *rcpt = *_rcpt; smtp_client_command_callback_t *callback; void *context; @@ -314,6 +315,8 @@ smtp_client_transaction_rcpt_fail_reply( if (callback != NULL) callback(reply, context); + + smtp_client_transaction_rcpt_free(_rcpt); } static void @@ -607,7 +610,7 @@ void smtp_client_transaction_fail_reply(struct smtp_client_transaction *trans, if (cmd != NULL) smtp_client_command_fail_reply(&cmd, reply); else - smtp_client_transaction_rcpt_fail_reply(rcpt, reply); + smtp_client_transaction_rcpt_fail_reply(&rcpt, reply); rcpt = rcpt_next; } @@ -630,9 +633,11 @@ void smtp_client_transaction_fail_reply(struct smtp_client_transaction *trans, /* the DATA command was not sent yet; call all DATA callbacks for the recipients that were previously accepted. */ - for (rcpt = trans->rcpts_data; rcpt != NULL; - rcpt = rcpt->next) { - smtp_client_transaction_rcpt_fail_reply(rcpt, reply); + rcpt = trans->rcpts_data; + while (rcpt != NULL) { + rcpt_next = rcpt->next; + smtp_client_transaction_rcpt_fail_reply(&rcpt, reply); + rcpt = rcpt_next; } if (trans->data_callback != NULL) trans->data_callback(reply, trans->data_context);