From: gaurav-aws Date: Sat, 16 Feb 2019 20:21:47 +0000 (+0000) Subject: Fix build failure when dynamic allocation is not enabled. X-Git-Tag: V10.2.0~11 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d51430facf30afb91eb438cf2ef77d9b67cbf110;p=freertos Fix build failure when dynamic allocation is not enabled. When dynamic allocation is not enabled, vPortFree is not available. The current code used vPortFree and this resulted in linker error. This commit removes the use of vPortFree when dynamic allocation is not enabled. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2631 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index 3c0b46267..51dfa0ce6 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -301,7 +301,7 @@ BaseType_t xReturn = pdFAIL; return pxNewTimer; } -#endif /* configSUPPORT_STATIC_ALLOCATION */ +#endif /* configSUPPORT_DYNAMIC_ALLOCATION */ /*-----------------------------------------------------------*/ #if( configSUPPORT_STATIC_ALLOCATION == 1 ) @@ -820,17 +820,29 @@ TickType_t xTimeNow; break; case tmrCOMMAND_DELETE : - /* The timer has already been removed from the active list, - just free up the memory if the memory was dynamically - allocated. */ - if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) == ( uint8_t ) 0 ) + #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) { - vPortFree( pxTimer ); + /* The timer has already been removed from the active list, + just free up the memory if the memory was dynamically + allocated. */ + if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) == ( uint8_t ) 0 ) + { + vPortFree( pxTimer ); + } + else + { + pxTimer->ucStatus &= ~tmrSTATUS_IS_ACTIVE; + } } - else + #else { + /* If dynamic allocation is not enabled, the memory + could not have been dynamically allocated. So there is + no need to free the memory - just mark the timer as + "not active". */ pxTimer->ucStatus &= ~tmrSTATUS_IS_ACTIVE; } + #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ break; default :