diff --git a/main/loader.c b/main/loader.c index cb88e346340f600bed8457dc57e44990a7ed3972..5fe84449f25ddbd479a2b860066f2bc1bbe6f529 100644 --- a/main/loader.c +++ b/main/loader.c @@ -870,6 +870,12 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi res = start_resource(mod); } + /* Now make sure that the list is sorted */ + AST_LIST_LOCK(&module_list); + AST_LIST_REMOVE(&module_list, mod, entry); + AST_LIST_INSERT_SORTALPHA(&module_list, mod, entry, resource); + AST_LIST_UNLOCK(&module_list); + return res; }