From: Andrey Volk Date: Tue, 1 Dec 2020 00:21:57 +0000 (+0400) Subject: [mod_sofia] Protect insertion into profile->reg_nh_hash with a mutex. X-Git-Tag: v1.10.6^2~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e3e0c7c2596c3870db79eedb51fe77cf45a89fc7;p=thirdparty%2Ffreeswitch.git [mod_sofia] Protect insertion into profile->reg_nh_hash with a mutex. --- diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index b1586405b7..5eee1c17e3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1933,7 +1933,6 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu switch_mutex_lock(profile->flag_mutex); hnh = switch_core_hash_find(profile->reg_nh_hash, key); - switch_mutex_unlock(profile->flag_mutex); if (!hnh) { if (!(sofia_private = su_alloc(nua_handle_get_home(nh), sizeof(*sofia_private)))) { @@ -1954,6 +1953,8 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu nua_handle_ref(nh); switch_core_hash_insert(profile->reg_nh_hash, key, nh); } + + switch_mutex_unlock(profile->flag_mutex); }