]> granicus.if.org Git - esp-idf/commitdiff
freertos: portCLEAN_UP_TCB should be performed before freeing tcb memory
authorMahavir Jain <mahavir@espressif.com>
Tue, 27 Mar 2018 14:02:43 +0000 (19:32 +0530)
committerMahavir Jain <mahavir@espressif.com>
Thu, 19 Apr 2018 12:58:55 +0000 (18:28 +0530)
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
components/freertos/tasks.c

index e95a8b04bc6bfeee23e567d61487ba501efb5431..980699ffcea3eed0c0ff311185f0e3b8a4fdeaa5 100644 (file)
@@ -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();
                        }
                }