summaryrefslogtreecommitdiff
path: root/lib/ldb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-07-24 12:11:03 -0700
committerJeremy Allison <jra@samba.org>2017-07-26 21:35:21 +0200
commit41b1f8a20c7db6b79706a4aebcc7074149a6ab62 (patch)
tree02a44c8339f359e7f149cb852bb960d97398ccae /lib/ldb
parentfe2ac3e304201d18ca15d388b622a4f15f72ad0a (diff)
downloadsamba-41b1f8a20c7db6b79706a4aebcc7074149a6ab62.tar.gz
lib: ldb: Use NULL to allocate modules not talloc_autofree_context().
ldb modules are not (yet) unloaded and are only loaded once (there is a check that makes sure of this). Allocate off the NULL context. We never want this to be freed until process shutdown. If eventually we add the ability to unload ldb modules we can add a deregister function that walks and frees the list. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb')
-rw-r--r--lib/ldb/common/ldb_modules.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c
index 3dd0438c128..25551e1a2ed 100644
--- a/lib/ldb/common/ldb_modules.c
+++ b/lib/ldb/common/ldb_modules.c
@@ -280,7 +280,17 @@ int ldb_register_module(const struct ldb_module_ops *ops)
if (ldb_find_module_ops(ops->name) != NULL)
return LDB_ERR_ENTRY_ALREADY_EXISTS;
- entry = talloc(talloc_autofree_context(), struct ops_list_entry);
+ /*
+ * ldb modules are not (yet) unloaded and
+ * are only loaded once (the above check
+ * makes sure of this). Allocate off the NULL
+ * context. We never want this to be freed
+ * until process shutdown. If eventually we
+ * want to unload ldb modules we can add a
+ * deregister function that walks and
+ * frees the list.
+ */
+ entry = talloc(NULL, struct ops_list_entry);
if (entry == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}