]> 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>
Tue, 14 Feb 2017 18:20:07 +0000 (20:20 +0200)
It must be NULL for the caller, unless save_dest_mail==TRUE

src/lib-lda/mail-deliver.c

index 4ab1baacaa06277f80d7058843789e63d2facc4e..cac4fa6aa853e84143e5f7756d3ad41d4888abd2 100644 (file)
@@ -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);