From: Arran Cudbard-Bell Date: Wed, 14 Jun 2023 22:11:01 +0000 (-0400) Subject: Virtual servers should be freed and unloaded before modules Closes #5062 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b19048e17e89d93f9b755c5d193cfc75f14effa;p=thirdparty%2Ffreeradius-server.git Virtual servers should be freed and unloaded before modules Closes #5062 --- diff --git a/src/bin/radiusd.c b/src/bin/radiusd.c index 1c5a1768b72..d64254710c2 100644 --- a/src/bin/radiusd.c +++ b/src/bin/radiusd.c @@ -1104,6 +1104,13 @@ cleanup: if (config) talloc_memory_report = config->talloc_memory_report; /* Grab this before we free the config */ + /* + * Virtual servers need to be freed before modules + * as state entries containing data with module-specific + * destructors may exist. + */ + virtual_servers_free(); + /* * Free modules, this needs to be done explicitly * because some libraries used by modules use atexit @@ -1113,11 +1120,6 @@ cleanup: */ modules_rlm_free(); - /* - * Same with virtual servers and proto modules. - */ - virtual_servers_free(); - /* * And now nothing should be left anywhere except the * parsed configuration items. diff --git a/src/bin/unit_test_module.c b/src/bin/unit_test_module.c index 6e2d9de3ea7..8873bc8ac74 100644 --- a/src/bin/unit_test_module.c +++ b/src/bin/unit_test_module.c @@ -1113,6 +1113,13 @@ cleanup: */ unlang_free_global(); + /* + * Virtual servers need to be freed before modules + * as state entries containing data with module-specific + * destructors may exist. + */ + virtual_servers_free(); + /* * Free modules, this needs to be done explicitly * because some libraries used by modules use atexit @@ -1122,11 +1129,6 @@ cleanup: */ modules_rlm_free(); - /* - * Same with virtual servers and proto modules. - */ - virtual_servers_free(); - /* * And now nothing should be left anywhere except the * parsed configuration items.