dovecot-2.2: dict-sql: Fixed memory leak when committing/rollbac...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 2 14:28:15 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/5c444f10cef9
changeset: 19061:5c444f10cef9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 02 17:26:08 2015 +0300
description:
dict-sql: Fixed memory leak when committing/rollbacking unchanged transaction.

diffstat:

 src/lib-dict/dict-sql.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 46eb03d95feb -r 5c444f10cef9 src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Wed Sep 02 17:23:45 2015 +0300
+++ b/src/lib-dict/dict-sql.c	Wed Sep 02 17:26:08 2015 +0300
@@ -546,7 +546,10 @@
 	if (ctx->failed) {
 		sql_transaction_rollback(&ctx->sql_ctx);
 		ret = -1;
-	} else if (_ctx->changed) {
+	} else if (!_ctx->changed) {
+		/* nothing changed, no need to commit */
+		sql_transaction_rollback(&ctx->sql_ctx);
+	} else {
 		if (sql_transaction_commit_s(&ctx->sql_ctx, &error) < 0) {
 			i_error("sql dict: commit failed: %s", error);
 			ret = -1;
@@ -576,8 +579,7 @@
 	struct sql_dict_transaction_context *ctx =
 		(struct sql_dict_transaction_context *)_ctx;
 
-	if (_ctx->changed)
-		sql_transaction_rollback(&ctx->sql_ctx);
+	sql_transaction_rollback(&ctx->sql_ctx);
 
 	if (ctx->inc_row_pool != NULL)
 		pool_unref(&ctx->inc_row_pool);


More information about the dovecot-cvs mailing list