Fixed Case 4525: Possible enterCriticalRegion without exitCriticalRegion if a WST_MEM_Pool runs empty.

Affects:
All C-language RXF releases using an RTOS.

Problem description:
If a MEM_Pool is out of memory we enter a critical region without exiting it. With an RTOS this causes taking a mutex which will not be freed again.

In the non-preemptive OO-RTX there is unusally no need to protect that region of WST_MEM_Pool_getMemory(). Future releases have support for a define WST_MEM_POOL_CRITICAL_REGIONS and will already contain corrected code for this issue.


Pseudocode:
Function WST_MEM_Pool_getMemory() in WST_MEM_Pool.c

enterCriticalRegion();

if ( isEmpty() )
{
[missing exitCriticalRegion();]
...
}
else
{
...
me->freeList = block->next;
exitCriticalRegion()
}

Solution:

Add missing exit critical region statement in isEmpty(me) == WSTTRUE path.

Please contact us, if you need a new release containing this fix for your environment or need help to implement this fix.