From: Arran Cudbard-Bell Date: Mon, 18 Apr 2022 23:10:19 +0000 (-0500) Subject: Cache pointer earlier X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ca491c7fd69e98892c9f0800104616bed63d5b1;p=thirdparty%2Ffreeradius-server.git Cache pointer earlier --- diff --git a/src/lib/server/module.c b/src/lib/server/module.c index 5482dacec6b..35fbbf6ce1d 100644 --- a/src/lib/server/module.c +++ b/src/lib/server/module.c @@ -1006,6 +1006,13 @@ module_instance_t *module_alloc(module_list_t *ml, } fr_assert(mi->dl_inst); + mi->module = (module_t const *)mi->dl_inst->module->common; + if (!mi->module) { + ERROR("Missing public structure for \"%s\"", qual_inst_name); + talloc_free(mi); + return NULL; + } + /* * If we're threaded, check if the module is thread-safe. * @@ -1020,12 +1027,7 @@ module_instance_t *module_alloc(module_list_t *ml, mi->name = talloc_typed_strdup(mi, qual_inst_name); talloc_free(qual_inst_name); /* Avoid stealing */ - mi->module = (module_t const *)mi->dl_inst->module->common; - if (!mi->module) { - ERROR("Missing public structure for \"%s\"", qual_inst_name); - talloc_free(mi); - return NULL; - } + mi->number = ml->last_number++; mi->ml = ml;