From c65a08d2fb4534fe60b56a61c0290d2c8bd4d47c Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Tue, 27 Mar 2018 19:32:43 +0530 Subject: [PATCH] freertos: portCLEAN_UP_TCB should be performed before freeing tcb memory Signed-off-by: Mahavir Jain --- components/freertos/tasks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/freertos/tasks.c b/components/freertos/tasks.c index e95a8b04bc..980699ffce 100644 --- a/components/freertos/tasks.c +++ b/components/freertos/tasks.c @@ -3878,6 +3878,10 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) static void prvDeleteTCB( TCB_t *pxTCB ) { + /* This call is required for any port specific cleanup related to task. + It must be above the vPortFree() calls. */ + portCLEAN_UP_TCB( pxTCB ); + /* Free up the memory allocated by the scheduler for the task. It is up to the task to free any memory allocated at the application level. */ #if ( configUSE_NEWLIB_REENTRANT == 1 ) @@ -3920,7 +3924,6 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask ) /* Neither the stack nor the TCB were allocated dynamically, so nothing needs to be freed. */ configASSERT( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB ) - portCLEAN_UP_TCB( pxTCB ); mtCOVERAGE_TEST_MARKER(); } } -- 2.50.1