summaryrefslogtreecommitdiff
path: root/main/loader.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2016-10-27 22:49:43 -0400
committerCorey Farrell <git@cfware.com>2016-10-28 01:11:21 -0400
commitf373de302032c13487cfcaa616fc070f10d68b57 (patch)
tree4451b091ff631011a14d12edfeb10857056dd387 /main/loader.c
parente8a3af2629ff8668b4ebd78a50bfebdbfaa66a6e (diff)
Fix shutdown crash caused by modules being left open.
It is only safe to run ast_register_cleanup callbacks when all modules have been unloaded. Previously these callbacks were run during graceful shutdown, making it possible to crash during shutdown. ASTERISK-26513 #close Change-Id: Ibfa635bb688d1227ec54aa211d90d6bd45052e21
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main/loader.c b/main/loader.c
index 85aeb249e..74254b4fa 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -613,7 +613,7 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
#endif
-void ast_module_shutdown(void)
+int modules_shutdown(void)
{
struct ast_module *mod;
int somethingchanged = 1, final = 0;
@@ -663,7 +663,10 @@ void ast_module_shutdown(void)
}
} while (somethingchanged && !final);
+ final = AST_DLLIST_EMPTY(&module_list);
AST_DLLIST_UNLOCK(&module_list);
+
+ return !final;
}
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode force)