]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] Protect insertion into profile->reg_nh_hash with a mutex.
authorAndrey Volk <andywolk@gmail.com>
Tue, 1 Dec 2020 00:21:57 +0000 (04:21 +0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Mar 2021 15:33:12 +0000 (18:33 +0300)
src/mod/endpoints/mod_sofia/sofia_reg.c

index b1586405b794de120e1030268afc99c9d1c29eaf..5eee1c17e35d8e4363511783da362ec50c8851d2 100644 (file)
@@ -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);
                }