This condition should NEVER be hit, but in case the started thread is unable to locate itself in the EVENT_DISOATCH_QUEUE_THREADS array, it's best to return null here and kill the unexpected event thread rather than segfault FS by writing outside of the bounds of the EVENT_DISPATCH_QUEUE_RUNNING array.

This commit is contained in:
William King 2013-05-25 06:51:22 -07:00
parent 5d939b9652
commit acf9a72e3f
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,7 @@
* Anthony Minessale II <anthm@freeswitch.org>
* Michael Jerris <mike@jerris.com>
* Paul D. Tinsley <pdt at jackhammer.org>
*
* William King <william.king@quentustech.com>
*
* switch_event.c -- Event System
*
@ -254,6 +254,10 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th
}
}
if ( my_id >= MAX_DISPATCH_VAL ) {
return NULL;
}
EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1;
switch_mutex_unlock(EVENT_QUEUE_MUTEX);