From e3e0c7c2596c3870db79eedb51fe77cf45a89fc7 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 1 Dec 2020 04:21:57 +0400 Subject: [PATCH] [mod_sofia] Protect insertion into profile->reg_nh_hash with a mutex. --- src/mod/endpoints/mod_sofia/sofia_reg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); }