]> jfr.im git - irc/charybdis-ircd/charybdis.git/commitdiff
tests: Fix use-after-free bug
authorSimon Arlott <sa.me.uk>
Sat, 31 Aug 2019 15:32:55 +0000 (16:32 +0100)
committerSimon Arlott <sa.me.uk>
Sat, 31 Aug 2019 15:32:55 +0000 (16:32 +0100)
tests/ircd_util.c

index d22333aa954034a956086bfa27cb89fecff0f242..866969fb55e1502125762fc4cf75e76edb0a4372 100644 (file)
@@ -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);
                }
        }
 }