From: Timo Sirainen Date: Tue, 14 Feb 2017 18:20:07 +0000 (+0200) Subject: lib-lda: Don't set mail_deliver_context.dest_mail too early. X-Git-Tag: 2.3.0.rc1~2107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04ca05320ecb84008aa1886e27020a4423b246c0;p=thirdparty%2Fdovecot%2Fcore.git lib-lda: Don't set mail_deliver_context.dest_mail too early. It must be NULL for the caller, unless save_dest_mail==TRUE --- diff --git a/src/lib-lda/mail-deliver.c b/src/lib-lda/mail-deliver.c index 4ab1baacaa..cac4fa6aa8 100644 --- a/src/lib-lda/mail-deliver.c +++ b/src/lib-lda/mail-deliver.c @@ -329,6 +329,7 @@ int mail_deliver_save(struct mail_deliver_context *ctx, const char *mailbox, struct mail_save_context *save_ctx; struct mailbox_header_lookup_ctx *headers_ctx; struct mail_keywords *kw; + struct mail *dest_mail; enum mail_error error; const char *mailbox_name, *errstr, *guid; struct mail_transaction_commit_changes changes; @@ -372,8 +373,8 @@ int mail_deliver_save(struct mail_deliver_context *ctx, const char *mailbox, mailbox_save_set_flags(save_ctx, flags, kw); headers_ctx = mailbox_header_lookup_init(box, lda_log_wanted_headers); - ctx->dest_mail = mailbox_save_get_dest_mail(save_ctx); - mail_add_temp_wanted_fields(ctx->dest_mail, lda_log_wanted_fetch_fields, NULL); + dest_mail = mailbox_save_get_dest_mail(save_ctx); + mail_add_temp_wanted_fields(dest_mail, lda_log_wanted_fetch_fields, NULL); mailbox_header_lookup_unref(&headers_ctx); mail_deliver_deduplicate_guid_if_needed(ctx->session, save_ctx);