From: Nathan Neulinger Date: Wed, 6 Jan 2016 17:23:52 +0000 (-0600) Subject: mod_skinny: silence CID 1320795 by rearranging mutex aquisition, negligible impact X-Git-Tag: v1.6.6~1^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff551827ab7ba36fdfb24a7e837ff37228f0ec76;p=thirdparty%2Ffreeswitch.git mod_skinny: silence CID 1320795 by rearranging mutex aquisition, negligible impact --- diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 25b8f6ff8b..4d2ad25bdd 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -2725,12 +2725,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) return SWITCH_STATUS_TERM; } switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); + + switch_mutex_lock(globals.mutex); switch_core_hash_init(&globals.profile_hash); globals.running = 1; globals.auto_restart = SWITCH_TRUE; + switch_mutex_unlock(globals.mutex); + /* load_skinny_config does it's own locking */ load_skinny_config(); + switch_mutex_lock(globals.mutex); + /* at least one profile */ if (switch_core_hash_empty( globals.profile_hash)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No profile found!\n"); @@ -2794,7 +2800,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) skinny_api_register(module_interface); /* launch listeners */ - switch_mutex_lock(globals.mutex); for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { void *val; skinny_profile_t *profile;