mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-14 04:54:49 +00:00
[Core] Fix race in switch_channel_get_state_handler()
This commit is contained in:
parent
7495917ac2
commit
045080e2c4
@ -3072,12 +3072,12 @@ SWITCH_DECLARE(const switch_state_handler_table_t *) switch_channel_get_state_ha
|
||||
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
if (index >= SWITCH_MAX_STATE_HANDLERS || index > channel->state_handler_index) {
|
||||
return NULL;
|
||||
switch_mutex_lock(channel->state_mutex);
|
||||
|
||||
if (index < SWITCH_MAX_STATE_HANDLERS && index <= channel->state_handler_index) {
|
||||
h = channel->state_handlers[index];
|
||||
}
|
||||
|
||||
switch_mutex_lock(channel->state_mutex);
|
||||
h = channel->state_handlers[index];
|
||||
switch_mutex_unlock(channel->state_mutex);
|
||||
|
||||
return h;
|
||||
|
Loading…
x
Reference in New Issue
Block a user