adjustments for consistency

This commit is contained in:
Cobus van Eeden 2020-12-05 16:01:47 -08:00
parent 8728996caf
commit 8aa5f3bba2
3 changed files with 4 additions and 4 deletions

View file

@ -138,7 +138,7 @@ void * pvPortMalloc( size_t xWantedSize )
{
/* Ensure xWantedSize will never wrap after adjustment, even if we need
* an alignment adjustment */
if ( xWantedSize < ( SIZE_MAX - heapSTRUCT_SIZE - portBYTE_ALIGNMENT - 1) )
if( ( xWantedSize > 0 ) && ( ( xWantedSize + xHeapStructSize ) > xWantedSize ) )
{
xWantedSize += heapSTRUCT_SIZE;
@ -154,7 +154,7 @@ void * pvPortMalloc( size_t xWantedSize )
}
}
if( xWantedSize > 0 )
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
{
/* Blocks are stored in byte order - traverse the list from the start
* (smallest) block until one of adequate size is found. */

View file

@ -176,7 +176,7 @@ void * pvPortMalloc( size_t xWantedSize )
mtCOVERAGE_TEST_MARKER();
}
if( ( xWantedSize > 0 ) && ( xWantedSize < xFreeBytesRemaining ) )
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
{
/* Traverse the list from the start (lowest address) block until
* one of adequate size is found. */

View file

@ -179,7 +179,7 @@ void * pvPortMalloc( size_t xWantedSize )
xWantedSize = 0;
}
if( ( xWantedSize > 0 ) && ( xWantedSize < xFreeBytesRemaining ) )
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
{
/* Traverse the list from the start (lowest address) block until
* one of adequate size is found. */