EXIT_WITH_FAILURE;
}
- /*
- * Setup the global structure for libraries
- */
- if (global_lib_init() < 0) EXIT_WITH_FAILURE;
-
/*
* Read the configuration files, BEFORE doing anything else.
*/
if (main_config_init(config) < 0) EXIT_WITH_FAILURE;
- /*
- * Instantiate any libraries loaded by config parsing
- */
- if (global_lib_instantiate() < 0) EXIT_WITH_FAILURE;
-
/*
* Check we're the only process using this config.
*/
*/
int global_lib_init(void)
{
+ if (lib_list) return;
+
MEM(lib_list = talloc_zero(NULL, global_lib_list_t));
fr_rb_inline_init(&lib_list->libs, global_lib_inst_t, entry, _lib_cmp, NULL);
{
dl_modules = dl_module_loader_init(uctx);
MEM(module_global_inst_list = fr_heap_alloc(NULL, _module_instance_global_cmp, module_instance_t, inst_idx, 256));
+
+ /*
+ * Ensure the common library tracking
+ * tree is in place...
+ */
+ global_lib_init();
}
static int _module_global_list_free(UNUSED void *uctx)
{
+
if (!fr_cond_assert_msg(fr_heap_num_elements(module_global_inst_list) == 0,
"Global module heap has %u elements remaining on exit. This is a leak",
fr_heap_num_elements(module_global_inst_list))) return -1;
module_rlm_virtual_t *vm;
fr_rb_iter_inorder_t iter;
CONF_SECTION *actions;
+
+ /*
+ * Ensure any libraries the modules depend on are instantiated
+ */
+ global_lib_instantiate();
+
/*
* Remember where the modules were stored.
*/
{
virtual_server_root = config;
+ /*
+ * Ensure any libraries the modules depend on are instantiated
+ */
+ global_lib_instantiate();
+
if (modules_bootstrap(process_modules) < 0) return -1;
if (modules_bootstrap(proto_modules) < 0) return -1;