]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir, sdbox: If committed transaction has only aborted msg saves, don't assert...
authorTimo Sirainen <tss@iki.fi>
Sat, 12 Mar 2011 15:18:47 +0000 (17:18 +0200)
committerTimo Sirainen <tss@iki.fi>
Sat, 12 Mar 2011 15:18:47 +0000 (17:18 +0200)
src/lib-storage/index/dbox-single/sdbox-save.c
src/lib-storage/index/maildir/maildir-save.c

index e4b8432ba32ef707dbbb0ca026b42244040e026e..d622286c7445eac7062806c0f9e5ebce333c9f71 100644 (file)
@@ -265,8 +265,12 @@ int sdbox_transaction_save_commit_pre(struct mail_save_context *_ctx)
 
        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) {
index 4cefd6b3b90e567380b9d11d896e9443637c48e5..43befe01248d93c48774e70ad5df17a136e146ce 100644 (file)
@@ -927,8 +927,12 @@ int maildir_transaction_save_commit_pre(struct mail_save_context *_ctx)
        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;