瀏覽代碼

fix(FreeRTOS): Initialize uxTaskNumber at task initialization

Signed-off-by: Laukik Hase <laukik.hase@espressif.com>

Closes https://github.com/espressif/esp-idf/pull/4025
Gautier Seidel 6 年之前
父節點
當前提交
7808bccfb9
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      components/freertos/tasks.c

+ 7 - 0
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