dovecot-1.1: Fixed several memory leaks in ACL plugin.

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 30 20:18:40 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/ba634d2c0ab9
changeset: 7469:ba634d2c0ab9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 30 20:18:37 2008 +0300
description:
Fixed several memory leaks in ACL plugin.

diffstat:

3 files changed, 16 insertions(+), 4 deletions(-)
src/plugins/acl/acl-backend-vfile.c |   13 ++++++++++---
src/plugins/acl/acl-cache.c         |    2 ++
src/plugins/acl/acl-mailbox-list.c  |    5 ++++-

diffs (62 lines):

diff -r 080dd4d2fd94 -r ba634d2c0ab9 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c	Wed Apr 30 17:06:19 2008 +0300
+++ b/src/plugins/acl/acl-backend-vfile.c	Wed Apr 30 20:18:37 2008 +0300
@@ -94,9 +94,16 @@ acl_backend_vfile_init(struct acl_backen
 	return 0;
 }
 
-static void acl_backend_vfile_deinit(struct acl_backend *backend)
-{
-	pool_unref(&backend->pool);
+static void acl_backend_vfile_deinit(struct acl_backend *_backend)
+{
+	struct acl_backend_vfile *backend =
+		(struct acl_backend_vfile *)_backend;
+
+	if (backend->acllist_pool != NULL) {
+		array_free(&backend->acllist);
+		pool_unref(&backend->acllist_pool);
+	}
+	pool_unref(&backend->backend.pool);
 }
 
 static struct acl_object *
diff -r 080dd4d2fd94 -r ba634d2c0ab9 src/plugins/acl/acl-cache.c
--- a/src/plugins/acl/acl-cache.c	Wed Apr 30 17:06:19 2008 +0300
+++ b/src/plugins/acl/acl-cache.c	Wed Apr 30 20:18:37 2008 +0300
@@ -62,6 +62,8 @@ void acl_cache_deinit(struct acl_cache *
 	struct acl_cache *cache = *_cache;
 
 	*_cache = NULL;
+
+	acl_cache_flush_all(cache);
 	array_free(&cache->right_idx_name_map);
 	hash_destroy(&cache->right_name_idx_map);
 	hash_destroy(&cache->objects);
diff -r 080dd4d2fd94 -r ba634d2c0ab9 src/plugins/acl/acl-mailbox-list.c
--- a/src/plugins/acl/acl-mailbox-list.c	Wed Apr 30 17:06:19 2008 +0300
+++ b/src/plugins/acl/acl-mailbox-list.c	Wed Apr 30 20:18:37 2008 +0300
@@ -112,12 +112,13 @@ acl_mailbox_try_list_fast(struct acl_mai
 			mailbox_list_iter_update(&ctx->ctx, ctx->tree,
 						 glob, FALSE, TRUE, name);
 		}
+		acl_backend_nonowner_lookups_iter_deinit(&nonowner_list_ctx);
+
 		if (ret == 0)
 			break;
 
 		/* try again */
 		mailbox_tree_deinit(&ctx->tree);
-		acl_backend_nonowner_lookups_iter_deinit(&nonowner_list_ctx);
 	}
 	if (ret < 0)
 		return FALSE;
@@ -246,6 +247,8 @@ acl_mailbox_list_iter_deinit(struct mail
 	}
 	if (ctx->tree_iter != NULL)
 		mailbox_tree_iterate_deinit(&ctx->tree_iter);
+	if (ctx->tree != NULL)
+		mailbox_tree_deinit(&ctx->tree);
 
 	i_free(ctx);
 	return ret;


More information about the dovecot-cvs mailing list