]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Cache pointer earlier
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 18 Apr 2022 23:10:19 +0000 (18:10 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 18 Apr 2022 23:10:19 +0000 (18:10 -0500)
src/lib/server/module.c

index 5482dacec6b57d91dab435c603d1dde1811b953c..35fbbf6ce1dfefe134e16fb93732d61833f9c872 100644 (file)
@@ -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;