*/
config_param_register("port");
+
+static config_t *global_config = NULL;
+
static inline config_t *config_new(void)
{
config_t *config = p_new(config_t, 1);
+ global_config = config;
return config;
}
if (*config) {
config_close(*config);
p_delete(config);
+ global_config = NULL;
}
}
+static void config_exit()
+{
+ if (global_config) {
+ config_delete(&global_config);
+ }
+}
+module_exit(config_exit);
static bool config_second_pass(config_t *config)
{
if (common_setup(pidfile, true, NULL, NULL, daemonize) != EXIT_SUCCESS
|| start_listener(config->port) < 0) {
- config_delete(&config);
return EXIT_FAILURE;
} else {
- int res = server_loop(query_starter, (delete_client_t)query_delete,
- policy_run, config_refresh, config);
- config_delete(&config);
- return res;
+ return server_loop(query_starter, (delete_client_t)query_delete,
+ policy_run, config_refresh, config);
}
}