From fee929c8acd788a77982b537953bf4053242057e Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Sat, 10 Mar 2018 04:33:33 -0500 Subject: core: Remove non-critical cleanup from startup aborts. When built-in components of Asterisk fail to start they cause the Asterisk startup to abort. In these cases only the most critical cleanup should be performed - closing databases and terminating proceses. These cleanups are registered using ast_register_atexit, all other cleanups should not be run during startup abort. The main reason for this change is that these cleanup procedures are untestable from the partially initialized states, if they fail it could prevent us from ever running the critical cleanup with ast_run_atexits. Create separate initialization for dns_core.c to be run unconditionally during startup instead of being initialized by the first dns resolver to be registered. This ensures that 'sched' is initialized before it can be potentially used. Replace ast_register_atexit with ast_register_cleanup in media_cache.c. There is no reason for this cleanup to happen unconditionally. Change-Id: Iecc2df98008b21509925ff16740bd5fa29527db3 --- main/core_local.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'main/core_local.c') diff --git a/main/core_local.c b/main/core_local.c index 23c7cce9d..c3fa15f6c 100644 --- a/main/core_local.c +++ b/main/core_local.c @@ -1049,7 +1049,6 @@ static void local_shutdown(void) int ast_local_init(void) { - if (STASIS_MESSAGE_TYPE_INIT(ast_local_optimization_begin_type)) { return -1; } @@ -1069,17 +1068,13 @@ int ast_local_init(void) locals = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, locals_cmp_cb); if (!locals) { - ao2_cleanup(local_tech.capabilities); - local_tech.capabilities = NULL; return -1; } /* Make sure we can register our channel type */ if (ast_channel_register(&local_tech)) { ast_log(LOG_ERROR, "Unable to register channel class 'Local'\n"); - ao2_ref(locals, -1); - ao2_cleanup(local_tech.capabilities); - local_tech.capabilities = NULL; + return -1; } ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local)); -- cgit v1.2.3