changeset 7469:ba634d2c0ab9 HEAD

Fixed several memory leaks in ACL plugin.
author Timo Sirainen <tss@iki.fi>
date Wed, 30 Apr 2008 20:18:37 +0300
parents 080dd4d2fd94
children 73368107aeda
files src/plugins/acl/acl-backend-vfile.c src/plugins/acl/acl-cache.c src/plugins/acl/acl-mailbox-list.c
diffstat 3 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	return 0;
 }
 
-static void acl_backend_vfile_deinit(struct acl_backend *backend)
+static void acl_backend_vfile_deinit(struct acl_backend *_backend)
 {
-	pool_unref(&backend->pool);
+	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 *
--- 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 @@
 	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);
--- 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 @@
 			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 @@
 	}
 	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;