From 702c503b7628520ec48b70f9bd851d84915bd4bd Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Fri, 25 Jul 2014 18:09:40 +0000 Subject: [PATCH] loader: Fix an infinite loop when printing modules using "module show". When creating the alphabetical sorted list each module is added to a list temporarily. On the second iteration each module already has a pointer to another module, causing stuff to go into a loop. ASTERISK-24123 #close Reported by: Malcolm Davenport git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419612 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/loader.c b/main/loader.c index 343863a034..b4eef13c28 100644 --- a/main/loader.c +++ b/main/loader.c @@ -1368,7 +1368,7 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr AST_LIST_INSERT_SORTALPHA(&alpha_module_list, cur, list_entry, resource); } - AST_LIST_TRAVERSE(&alpha_module_list, cur, list_entry) { + while ((cur = AST_LIST_REMOVE_HEAD(&alpha_module_list, list_entry))) { total_mod_loaded += modentry(cur->resource, cur->info->description, cur->usecount, cur->flags.running ? "Running" : "Not Running", like, cur->info->support_level); }