diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 889b920ef8..22a2428ccc 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2054,8 +2054,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name); - switch_thread_rwlock_wrlock(profile->rwlock); + sofia_reg_unregister(profile); nua_shutdown(profile->nua); @@ -2118,6 +2117,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void } } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock %s\n", profile->name); + switch_thread_rwlock_wrlock(profile->rwlock); + //su_home_unref(profile->home); su_root_destroy(profile->s_root); //pool = profile->pool;