From: Evan Hunter Date: Fri, 26 Aug 2011 06:30:45 +0000 (+1000) Subject: Fix off by one bug in FreeRTOS X-Git-Tag: v0.6.0-rc1~598 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e175f027151b11549dba56d8892977ee2ae8aa5d;p=openocd Fix off by one bug in FreeRTOS --- diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c index 24397ef6..10a9b8c0 100644 --- a/src/rtos/FreeRTOS.c +++ b/src/rtos/FreeRTOS.c @@ -233,10 +233,10 @@ static int FreeRTOS_update_threads( struct rtos *rtos ) retval = target_read_buffer( rtos->target, rtos->symbols[FreeRTOS_VAL_uxTopUsedPriority].address, param->pointer_width, (uint8_t *)&max_used_priority ); - symbol_address_t* list_of_lists = (symbol_address_t *)malloc( sizeof( symbol_address_t ) * ( max_used_priority + 5 ) ); + symbol_address_t* list_of_lists = (symbol_address_t *)malloc( sizeof( symbol_address_t ) * ( max_used_priority+1 + 5 ) ); int num_lists; - for( num_lists = 0; num_lists < max_used_priority; num_lists++ ) + for( num_lists = 0; num_lists <= max_used_priority; num_lists++ ) { list_of_lists[num_lists] = rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address + num_lists * param->list_width; }