changeset 12844:b896d72d7fa7

maildir, sdbox: If committed transaction has only aborted msg saves, don't assert-crash.
author Timo Sirainen <tss@iki.fi>
date Sat, 12 Mar 2011 17:18:47 +0200
parents 4b537650b4de
children d3d6ed6d268b
files src/lib-storage/index/dbox-single/sdbox-save.c src/lib-storage/index/maildir/maildir-save.c
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-single/sdbox-save.c	Sat Mar 12 15:48:24 2011 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-save.c	Sat Mar 12 17:18:47 2011 +0200
@@ -265,8 +265,12 @@
 
 	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) {
--- a/src/lib-storage/index/maildir/maildir-save.c	Sat Mar 12 15:48:24 2011 +0200
+++ b/src/lib-storage/index/maildir/maildir-save.c	Sat Mar 12 17:18:47 2011 +0200
@@ -927,8 +927,12 @@
 	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;