changeset 21553:4a2884480ddc

lib-lda: Don't set mail_deliver_context.dest_mail too early. It must be NULL for the caller, unless save_dest_mail==TRUE
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 14 Feb 2017 20:20:07 +0200
parents f48743eb38c6
children 7a2f1c800c8c
files src/lib-lda/mail-deliver.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-lda/mail-deliver.c	Mon Feb 13 20:49:12 2017 +0200
+++ b/src/lib-lda/mail-deliver.c	Tue Feb 14 20:20:07 2017 +0200
@@ -326,6 +326,7 @@
 	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;
@@ -369,8 +370,8 @@
 	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);