From: Alan T. DeKok Date: Sun, 5 Aug 2018 14:29:33 +0000 (-0400) Subject: use local radmin_ctx && free it on stop X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2014db82f26fc7916854b5bc026edd68c2f1ddde;p=thirdparty%2Ffreeradius-server.git use local radmin_ctx && free it on stop --- diff --git a/src/bin/radmin.c b/src/bin/radmin.c index e5fd55340c9..c427bd0dbd9 100644 --- a/src/bin/radmin.c +++ b/src/bin/radmin.c @@ -61,6 +61,7 @@ static pthread_t pthread_id; static bool stop = false; static int context = 0; static fr_cmd_info_t radmin_info; +static TALLOC_CTX *radmin_ctx; #ifndef USE_READLINE /* @@ -920,6 +921,9 @@ static fr_cmd_table_t cmd_table[] = { int fr_radmin_start(main_config_t *config, bool cli) { + radmin_ctx = talloc_init("radmin"); + if (!radmin_ctx) return -1; + gettimeofday(&start_time, NULL); #ifdef USE_READLINE @@ -929,7 +933,7 @@ int fr_radmin_start(main_config_t *config, bool cli) fr_command_register_hook = fr_radmin_register; radmin_main_config = config; - if (fr_radmin_register(NULL, NULL, cmd_table) < 0) { + if (fr_radmin_register(radmin_ctx, NULL, cmd_table) < 0) { PERROR("Failed initializing radmin"); return -1; } @@ -956,6 +960,8 @@ void fr_radmin_stop(void) stop = true; (void) pthread_join(pthread_id, NULL); + + TALLOC_FREE(radmin_ctx); } /*