Author: anthm Date: Fri Aug 15 17:57:57 2008 New Revision: 9307 Modified: freeswitch/trunk/src/switch_time.c Changes in other areas also in this revision: Modified: freeswitch/trunk/ (props changed) Log: prevent crash in crazy situation with xml_curl and bad urls FSCORE-169 Modified: freeswitch/trunk/src/switch_time.c ============================================================================== --- freeswitch/trunk/src/switch_time.c (original) +++ freeswitch/trunk/src/switch_time.c Fri Aug 15 17:57:57 2008 @@ -289,13 +289,17 @@ static switch_status_t timer_destroy(switch_timer_t *timer) { timer_private_t *private_info = timer->private_info; - switch_mutex_lock(globals.mutex); - TIMER_MATRIX[timer->interval].count--; - if (TIMER_MATRIX[timer->interval].count == 0) { - TIMER_MATRIX[timer->interval].tick = 0; + if (timer->interval < MAX_ELEMENTS) { + switch_mutex_lock(globals.mutex); + TIMER_MATRIX[timer->interval].count--; + if (TIMER_MATRIX[timer->interval].count == 0) { + TIMER_MATRIX[timer->interval].tick = 0; + } + switch_mutex_unlock(globals.mutex); + } + if (private_info) { + private_info->ready = 0; } - switch_mutex_unlock(globals.mutex); - private_info->ready = 0; return SWITCH_STATUS_SUCCESS; } Diffs of changes in other areas also in this revision: