提交 ff551827 authored 作者: Nathan Neulinger's avatar Nathan Neulinger

mod_skinny: silence CID 1320795 by rearranging mutex aquisition, negligible impact

上级 435c4636
...@@ -2725,12 +2725,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) ...@@ -2725,12 +2725,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
return SWITCH_STATUS_TERM; return SWITCH_STATUS_TERM;
} }
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
switch_mutex_lock(globals.mutex);
switch_core_hash_init(&globals.profile_hash); switch_core_hash_init(&globals.profile_hash);
globals.running = 1; globals.running = 1;
globals.auto_restart = SWITCH_TRUE; globals.auto_restart = SWITCH_TRUE;
switch_mutex_unlock(globals.mutex);
/* load_skinny_config does it's own locking */
load_skinny_config(); load_skinny_config();
switch_mutex_lock(globals.mutex);
/* at least one profile */ /* at least one profile */
if (switch_core_hash_empty( globals.profile_hash)) { if (switch_core_hash_empty( globals.profile_hash)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No profile found!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No profile found!\n");
...@@ -2794,7 +2800,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) ...@@ -2794,7 +2800,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
skinny_api_register(module_interface); skinny_api_register(module_interface);
/* launch listeners */ /* launch listeners */
switch_mutex_lock(globals.mutex);
for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
void *val; void *val;
skinny_profile_t *profile; skinny_profile_t *profile;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论