From 7808bccfb9779eb0fba93423fc3c8264e2855b0d Mon Sep 17 00:00:00 2001 From: Gautier Seidel Date: Thu, 5 Sep 2019 13:19:49 +0200 Subject: [PATCH] fix(FreeRTOS): Initialize uxTaskNumber at task initialization Signed-off-by: Laukik Hase Closes https://github.com/espressif/esp-idf/pull/4025 --- components/freertos/tasks.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index 95180b79ae..dd0487958c 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -917,6 +917,13 @@ UBaseType_t x; } #endif /* tskSET_NEW_STACKS_TO_KNOWN_VALUE */ + #if( configUSE_TRACE_FACILITY == 1 ) + { + /* Zero the uxTaskNumber TCB member to avoid random value from dynamically allocated TCBs */ + pxNewTCB->uxTaskNumber = 0; + } + #endif /* ( configUSE_TRACE_FACILITY == 1 ) */ + /* Calculate the top of stack address. This depends on whether the stack grows from high memory to low (as per the 80x86) or vice versa. portSTACK_GROWTH is used to make the result positive or negative as required