size_t pool_size = 0;
void *pool_page_start = NULL, *pool_page_end = NULL;
bool do_mprotect;
+ dl_module_loader_t *dl_modules = NULL;
/*
* Setup talloc callbacks so we get useful errors
* config file parser. Note that we pass an empty path
* here, as we haven't yet read the configuration file.
*/
- if (!dl_module_loader_init(global_ctx, NULL)) {
+ dl_modules = dl_module_loader_init(NULL);
+ if (!dl_modules) {
fr_perror("%s", program);
EXIT_WITH_FAILURE;
}
*/
main_config_free(&config);
+ /*
+ * Free the modules that we loaded.
+ */
+ if (dl_modules) talloc_free(dl_modules);
+
/*
* Cleanup everything else
*/
fr_dict_t *dict = NULL;
int ret = EXIT_SUCCESS;
TALLOC_CTX *autofree = talloc_autofree_context();
+ dl_module_loader_t *dl_modules = NULL;
#ifndef NDEBUG
if (fr_fault_setup(autofree, getenv("PANIC_ACTION"), argv[0]) < 0) {
EXIT_WITH_FAILURE;
}
- if (!dl_module_loader_init(autofree, NULL)) {
+ dl_modules = dl_module_loader_init(NULL);
+ if (!dl_modules) {
fr_perror("unit_test_attribute");
EXIT_WITH_FAILURE;
}
* memory, so we get clean talloc reports.
*/
cleanup:
+ if (dl_modules) talloc_free(dl_modules);
fr_dict_free(&dict);
xlat_free();
fr_strerror_free();
char *p;
main_config_t *config;
+ dl_module_loader_t *dl_modules = NULL;
config = main_config_alloc(autofree);
if (!config) {
* Initialize the DL infrastructure, which is used by the
* config file parser.
*/
- if (!dl_module_loader_init(autofree, config->lib_dir)) {
+ dl_modules = dl_module_loader_init(config->lib_dir);
+ if (!dl_modules) {
fr_perror("%s", config->name);
EXIT_WITH_FAILURE;
}
*/
fr_dict_free(&dict);
+ if (dl_modules) talloc_free(dl_modules);
+
/*
* Now we're sure no more triggers can fire, free the
* trigger tree
/** Initialise structures needed by the dynamic linker
*
*/
-dl_module_loader_t *dl_module_loader_init(TALLOC_CTX *ctx, char const *lib_dir)
+dl_module_loader_t *dl_module_loader_init(char const *lib_dir)
{
if (dl_module_loader) {
/*
return dl_module_loader;
}
- dl_module_loader = talloc_zero(ctx, dl_module_loader_t);
+ dl_module_loader = talloc_zero(NULL, dl_module_loader_t);
if (!dl_module_loader) {
ERROR("Failed initialising uctx for dl_loader");
return NULL;
dl_loader_t *dl_loader_from_module_loader(dl_module_loader_t *dl_module_loader);
-dl_module_loader_t *dl_module_loader_init(TALLOC_CTX *ctx, char const *lib_dir);
+dl_module_loader_t *dl_module_loader_init(char const *lib_dir);
#ifdef __cplusplus
}
* Initialize the DL infrastructure, which is used by the
* config file parser. And also add in the search path.
*/
- if (!dl_module_loader_init(NULL, main_config->lib_dir)) {
+ if (!dl_module_loader_init(main_config->lib_dir)) {
cf_log_err(ci, "Failed initializing 'lib_dir': %s",
fr_strerror());
return -1;