[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-transaction.c, 1.5, 1.6

cras at dovecot.org cras at dovecot.org
Thu Oct 21 23:58:26 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv5939/lib-storage/index/maildir

Modified Files:
	maildir-transaction.c 
Log Message:
Don't access freed memory.



Index: maildir-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-transaction.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- maildir-transaction.c	17 Oct 2004 14:35:01 -0000	1.5
+++ maildir-transaction.c	21 Oct 2004 20:58:23 -0000	1.6
@@ -20,6 +20,7 @@
 	struct maildir_transaction_context *t =
 		(struct maildir_transaction_context *)_t;
 	struct index_mailbox *ibox = t->ictx.ibox;
+	struct maildir_save_context *save_ctx;
 	int ret = 0;
 
 	if (t->save_ctx != NULL) {
@@ -33,13 +34,17 @@
 			ret = -1;
 	}
 
+	save_ctx = t->save_ctx;
+
 	if (index_transaction_commit(_t) < 0)
 		return -1;
 
-	if (t->save_ctx != NULL) {
+	/* transaction is destroyed. */
+
+	if (save_ctx != NULL) {
 		/* unlock uidlist file after writing to transaction log,
 		   to make sure we don't write uids in wrong order. */
-		maildir_transaction_save_commit_post(t->save_ctx);
+		maildir_transaction_save_commit_post(save_ctx);
 	}
 
 	return ret < 0 ? -1 : maildir_sync_last_commit(ibox);



More information about the dovecot-cvs mailing list