void index_save_context_free(struct mail_save_context *ctx)
{
index_mail_save_finish(ctx);
+ if (ctx->data.keywords != NULL)
+ mailbox_keywords_unref(&ctx->data.keywords);
i_free_and_null(ctx->data.from_envelope);
i_free_and_null(ctx->data.guid);
i_free_and_null(ctx->data.pop3_uidl);
{
i_assert(ctx->copying_or_moving);
- if (ctx->data.keywords != NULL) {
- /* keywords gets unreferenced twice: first in
- mailbox_save_cancel()/_finish() and second time in
- mailbox_copy(). */
- mailbox_keywords_ref(ctx->data.keywords);
- }
-
if (mail_storage_try_copy(&ctx, mail) < 0) {
if (ctx != NULL)
mailbox_save_cancel(&ctx);
struct mailbox_transaction_context *t = ctx->transaction;
/* we need to keep a copy of this because save_finish implementations
will likely zero the data structure during cleanup */
- struct mail_keywords *keywords = ctx->data.keywords;
enum mail_flags pvt_flags = ctx->data.pvt_flags;
bool copying_via_save = ctx->copying_via_save;
int ret;
t->save_count++;
}
- if (keywords != NULL)
- mailbox_keywords_unref(&keywords);
mailbox_save_context_reset(ctx, TRUE);
return ret;
}
void mailbox_save_cancel(struct mail_save_context **_ctx)
{
struct mail_save_context *ctx = *_ctx;
- struct mail_keywords *keywords = ctx->data.keywords;
*_ctx = NULL;
T_BEGIN {
ctx->transaction->box->v.save_cancel(ctx);
} T_END;
- if (keywords != NULL && !ctx->finishing)
- mailbox_keywords_unref(&keywords);
/* the dest_mail is no longer valid. if we're still saving
more mails, the mail sequence may get reused. make sure
{
struct mail_save_context *ctx = *_ctx;
struct mailbox_transaction_context *t = ctx->transaction;
- struct mail_keywords *keywords = ctx->data.keywords;
enum mail_flags pvt_flags = ctx->data.pvt_flags;
struct mail *backend_mail;
int ret;
mailbox_save_add_pvt_flags(t, pvt_flags);
t->save_count++;
}
- if (keywords != NULL)
- mailbox_keywords_unref(&keywords);
i_assert(!ctx->unfinished);
ctx->copy_src_mail = NULL;