From 6af9b013eb056cdd4a2349ddedf634afa2f7847b Mon Sep 17 00:00:00 2001 From: Richard Barry Date: Wed, 9 Apr 2014 09:07:19 +0000 Subject: [PATCH] Ensure xNewLib_reent is reclaimed when a task is deleted. --- FreeRTOS/Source/tasks.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index c20aeed540..60d62b09a3 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -3086,8 +3086,13 @@ TCB_t *pxNewTCB; want to allocate and clean RAM statically. */ 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. */ + /* 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 ) + { + _reclaim_reent( &( pxTCB->xNewLib_reent ) ); + } + #endif /* configUSE_NEWLIB_REENTRANT */ vPortFreeAligned( pxTCB->pxStack ); vPortFree( pxTCB ); }