]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
prevent crash in crazy situation with xml_curl and bad urls FSCORE-169
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 15 Aug 2008 21:57:57 +0000 (21:57 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 15 Aug 2008 21:57:57 +0000 (21:57 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9307 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_time.c

index 1393b3072841e594764fb100b45a35bbdbca1f0d..3e0e991adb3399e37865a8eb423426e704e83332 100644 (file)
@@ -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;
 }