dovecot-2.1: lib-storage: Fixed potential memory leak when mailb...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 3 05:43:36 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/28be06dbd65e
changeset: 14754:28be06dbd65e
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 03 05:43:27 2012 +0300
description:
lib-storage: Fixed potential memory leak when mailbox_transaction_commit_get_changes() failed

diffstat:

 src/lib-storage/mail-storage.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 16f2f71c91b1 -r 28be06dbd65e src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Wed Oct 03 05:42:55 2012 +0300
+++ b/src/lib-storage/mail-storage.c	Wed Oct 03 05:43:27 2012 +0300
@@ -1485,7 +1485,6 @@
 
 	/* Store changes temporarily so that plugins overriding
 	   transaction_commit() can look at them. */
-	changes.pool = NULL;
 	ret = mailbox_transaction_commit_get_changes(t, &changes);
 	if (changes.pool != NULL)
 		pool_unref(&changes.pool);
@@ -1500,11 +1499,14 @@
 	int ret;
 
 	t->box->transaction_count--;
+	changes_r->pool = NULL;
 
 	*_t = NULL;
 	T_BEGIN {
 		ret = t->box->v.transaction_commit(t, changes_r);
 	} T_END;
+	if (ret < 0 && changes_r->pool != NULL)
+		pool_unref(&changes_r->pool);
 	return ret;
 }
 


More information about the dovecot-cvs mailing list