]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lda: Don't set mail_deliver_context.dest_mail too early.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 14 Feb 2017 18:20:07 +0000 (20:20 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Feb 2017 09:32:32 +0000 (11:32 +0200)
It must be NULL for the caller, unless save_dest_mail==TRUE

src/lib-lda/mail-deliver.c

index caf2711514eb0ce13171d30d9fb7bbb59848d5a1..c881a343db4be380094295e710b11c0840a77986 100644 (file)
@@ -326,6 +326,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;
@@ -369,8 +370,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);