From 493f729efcb3387f1186d7b6cdc17ef6278c504a Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Sat, 31 Aug 2019 16:32:55 +0100 Subject: [PATCH] tests: Fix use-after-free bug --- tests/ircd_util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/ircd_util.c b/tests/ircd_util.c index d22333aa..866969fb 100644 --- a/tests/ircd_util.c +++ b/tests/ircd_util.c @@ -100,10 +100,13 @@ void ircd_util_init(const char *name) void ircd_util_reload_module(const char *name) { struct module *mod = findmodule_byname(name); + int origin, core; if (ok(mod != NULL, MSG)) { + origin = mod->origin; + core = mod->core; if (ok(unload_one_module(name, false), MSG)) { - ok(load_one_module(name, mod->origin, mod->core), MSG); + ok(load_one_module(name, origin, core), MSG); } } }