From ef4d71cfc7d4915f2768a957d834cfc569a1b717 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Sun, 12 May 2024 10:53:36 -0600 Subject: [PATCH] Tweak to process virtual server sections before calling the instantiate function --- src/lib/server/virtual_servers.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index 97b3cc1864..3f8d3f4422 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -1465,18 +1465,11 @@ int virtual_servers_instantiate(void) fr_assert(virtual_servers[i]->process_mi); - /* - * Complete final instantiation of the process module - */ - if (module_instantiate(virtual_servers[i]->process_mi) < 0) { - cf_log_perr(virtual_servers[i]->process_mi->conf, - "Failed instantiating process module"); - return -1; - } - /* * Compile the processing sections indicated by - * the process module. + * the process module. This must be done before + * module_instantiate is called, as the instance + * data is protected after this call. */ if (process->compile_list) { tmpl_rules_t parse_rules = { @@ -1494,6 +1487,15 @@ int virtual_servers_instantiate(void) } } + /* + * Complete final instantiation of the process module + */ + if (module_instantiate(virtual_servers[i]->process_mi) < 0) { + cf_log_perr(virtual_servers[i]->process_mi->conf, + "Failed instantiating process module"); + return -1; + } + /* * Print out warnings for unused "recv" and * "send" sections. -- 2.47.3