rtos/FreeRTOS: Fix FreeRTOS thread list reading
authorRahul Masurkar <rahulgm@marvell.com>
Tue, 6 Aug 2019 12:49:07 +0000 (18:19 +0530)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 2 Jan 2020 21:20:29 +0000 (21:20 +0000)
Change-Id: I749ae94ec7279907b1905c02ecc1e9661f43ef70
Signed-off-by: Rahul Masurkar <rahulgm@marvell.com>
Reviewed-on: http://openocd.zylin.com/5273
Tested-by: jenkins
Reviewed-by: Karl Palsson <karlp@tweak.net.au>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/rtos/FreeRTOS.c

index 9d89974cce64078c1e37f2a78215cd8b26297bb2..77c6e79d5414e99025d7cec073dcc8d4f80449ed 100644 (file)
@@ -263,14 +263,14 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
 
        symbol_address_t *list_of_lists =
                malloc(sizeof(symbol_address_t) *
-                       (max_used_priority+1 + 5));
+                       (max_used_priority + 5));
        if (!list_of_lists) {
                LOG_ERROR("Error allocating memory for %" PRId64 " priorities", max_used_priority);
                return ERROR_FAIL;
        }
 
        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;