]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fixed several memory leaks in ACL plugin.
authorTimo Sirainen <tss@iki.fi>
Wed, 30 Apr 2008 17:18:37 +0000 (20:18 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 30 Apr 2008 17:18:37 +0000 (20:18 +0300)
--HG--
branch : HEAD

src/plugins/acl/acl-backend-vfile.c
src/plugins/acl/acl-cache.c
src/plugins/acl/acl-mailbox-list.c

index a0d19092f40a98ba1d7d53a0cd68b7b49fd4597f..35605265f06727f460966b467bc8ede876dcb07c 100644 (file)
@@ -94,9 +94,16 @@ acl_backend_vfile_init(struct acl_backend *_backend, const char *data)
        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 *
index a02868773247874f04df7e40261eedb1056449c5..8675a194535145ee1a2abcc845fb385ff8de6f96 100644 (file)
@@ -62,6 +62,8 @@ void acl_cache_deinit(struct acl_cache **_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);
index 6339682a402f823756b34a9fe197167b97d5aeeb..6ac8c1c0257c9d87f976c9632d45b5cbc583fedd 100644 (file)
@@ -112,12 +112,13 @@ acl_mailbox_try_list_fast(struct acl_mailbox_list_iterate_context *ctx,
                        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 mailbox_list_iterate_context *_ctx)
        }
        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;