i_assert(ctx->ctx.finished);
- if (array_count(&ctx->files) == 0)
+ if (array_count(&ctx->files) == 0) {
+ /* the mail must be freed in the commit_pre() */
+ if (ctx->ctx.mail != NULL)
+ mail_free(&ctx->ctx.mail);
return 0;
+ }
if (sdbox_sync_begin(ctx->mbox, SDBOX_SYNC_FLAG_FORCE |
SDBOX_SYNC_FLAG_FSYNC, &ctx->sync_ctx) < 0) {
i_assert(_ctx->output == NULL);
i_assert(ctx->last_save_finished);
- if (ctx->files_count == 0)
+ if (ctx->files_count == 0) {
+ /* the mail must be freed in the commit_pre() */
+ if (ctx->mail != NULL)
+ mail_free(&ctx->mail);
return 0;
+ }
sync_flags = MAILDIR_UIDLIST_SYNC_PARTIAL |
MAILDIR_UIDLIST_SYNC_NOREFRESH;