From 5169e58acad0da7fc36d5ae5e83736ff7d6bdef3 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 17 Apr 2021 01:06:21 +0300 Subject: [PATCH] [Core] Fix wrong lock order in switch_user_sql_thread() --- src/switch_core_sqldb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 38bfa9448f..8d9eaf152c 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -2287,10 +2287,11 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, switch_mutex_lock(qm->cond2_mutex); if (qm->skip_wait > 0) { qm->skip_wait--; + switch_mutex_unlock(qm->cond2_mutex); } else { + switch_mutex_unlock(qm->cond2_mutex); switch_thread_cond_wait(qm->cond, qm->cond_mutex); } - switch_mutex_unlock(qm->cond2_mutex); } i = 40;