From: Anthony Minessale Date: Fri, 15 Aug 2008 21:57:57 +0000 (+0000) Subject: prevent crash in crazy situation with xml_curl and bad urls FSCORE-169 X-Git-Tag: v1.0.2~1428 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb22c466da8458ae2302d96e6d8818dd51995bac;p=thirdparty%2Ffreeswitch.git prevent crash in crazy situation with xml_curl and bad urls FSCORE-169 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9307 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_time.c b/src/switch_time.c index 1393b30728..3e0e991adb 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -289,13 +289,17 @@ static switch_status_t timer_check(switch_timer_t *timer, switch_bool_t step) 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; }