From e9cf10583afc85f25ff2b9ea21e57fec33485377 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Jun 2024 15:14:29 +0300 Subject: [PATCH] [Core] process_device_hup: Coverity 1546196 Check of thread-shared field evades lock acquisition --- src/switch_channel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index afb18aa503..013701e7a5 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -5185,11 +5185,13 @@ static void process_device_hup(switch_channel_t *channel) switch_device_record_t *drec = NULL; switch_device_node_t *node; + switch_mutex_lock(globals.device_mutex); if (!channel->device_node) { + switch_mutex_unlock(globals.device_mutex); + return; } - switch_mutex_lock(globals.device_mutex); node = channel->device_node; drec = channel->device_node->parent;