Merge branch 'bugfix/freertos_wcaps_coproc' into 'master'

fix(freertos): fix a bug in `prvTaskDeleteWithCaps` related to coprocessors

Closes IDF-12202

See merge request espressif/esp-idf!36890
This commit is contained in:
Omar Chebib 2025-02-19 09:39:05 +08:00
commit 7559275fef

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -100,15 +100,18 @@ err:
configASSERT( eRunning != eTaskGetState( xTaskToDelete ) );
/* We can delete the task and free the memory buffers.
* First, we must call `vTaskDelete` so that the port task delete callback is called.
* On targets that have coprocessors, it may be possible that the stack pointer is modified (restored)
* during this phase, hence, it must be done before getting the statuc buffers out of the task. */
vTaskDelete( xTaskToDelete );
/* Free the memory buffers */
xResult = xTaskGetStaticBuffers( xTaskToDelete, &puxStackBuffer, &pxTaskBuffer );
configASSERT( xResult == pdTRUE );
configASSERT( puxStackBuffer != NULL );
configASSERT( pxTaskBuffer != NULL );
/* We can delete the task and free the memory buffers. */
vTaskDelete( xTaskToDelete );
/* Free the memory buffers */
heap_caps_free( puxStackBuffer );
vPortFree( pxTaskBuffer );
}