changeset 6879:fed2843b4ab8 HEAD

Error handling fixes
author Timo Sirainen <tss@iki.fi>
date Sat, 01 Dec 2007 09:09:47 +0200
parents 0c3ab0aef33c
children 724c8f12eed2
files src/lib-storage/index/maildir/maildir-save.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-save.c	Sat Dec 01 09:09:21 2007 +0200
+++ b/src/lib-storage/index/maildir/maildir-save.c	Sat Dec 01 09:09:47 2007 +0200
@@ -702,9 +702,11 @@
 		   Dovecot instances haven't yet seen the files. */
 		maildir_transaction_unlink_copied_files(ctx, mf);
 
-		maildir_keywords_sync_deinit(&ctx->keywords_sync_ctx);
+		if (ctx->keywords_sync_ctx != NULL)
+			maildir_keywords_sync_deinit(&ctx->keywords_sync_ctx);
 		/* returning failure finishes the save_context */
 		maildir_transaction_save_rollback(ctx);
+		return -1;
 	}
 
 	if (ctx->mail != NULL)
@@ -755,10 +757,10 @@
 	if (hardlinks)
 		maildir_transaction_unlink_copied_files(ctx, NULL);
 
-	if (ctx->locked) {
+	if (ctx->uidlist_sync_ctx != NULL)
 		(void)maildir_uidlist_sync_deinit(&ctx->uidlist_sync_ctx);
+	if (ctx->locked)
 		maildir_uidlist_unlock(ctx->mbox->uidlist);
-	}
 	if (ctx->sync_ctx != NULL)
 		(void)maildir_sync_index_finish(&ctx->sync_ctx, TRUE, FALSE);