@ -159,9 +159,17 @@ void * pvPortMalloc( size_t xWantedSize )
if ( xWantedSize > 0 )
if ( xWantedSize > 0 )
{
{
/* The wanted size must be increased so it can contain a BlockLink_t
/* The wanted size must be increased so it can contain a BlockLink_t
* structure in addition to the requested amount of bytes . Some
* structure in addition to the requested amount of bytes . */
* additional increment may also be needed for alignment . */
if ( heapADD_WILL_OVERFLOW ( xWantedSize , xHeapStructSize ) = = 0 )
xAdditionalRequiredSize = xHeapStructSize + portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ;
{
xWantedSize + = xHeapStructSize ;
/* Ensure that blocks are always aligned to the required number
* of bytes . */
if ( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ! = 0x00 )
{
/* Byte alignment required. */
xAdditionalRequiredSize = portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ;
if ( heapADD_WILL_OVERFLOW ( xWantedSize , xAdditionalRequiredSize ) = = 0 )
if ( heapADD_WILL_OVERFLOW ( xWantedSize , xAdditionalRequiredSize ) = = 0 )
{
{
@ -176,6 +184,16 @@ void * pvPortMalloc( size_t xWantedSize )
{
{
mtCOVERAGE_TEST_MARKER ( ) ;
mtCOVERAGE_TEST_MARKER ( ) ;
}
}
}
else
{
xWantedSize = 0 ;
}
}
else
{
mtCOVERAGE_TEST_MARKER ( ) ;
}
/* Check the block size we are trying to allocate is not so large that the
/* Check the block size we are trying to allocate is not so large that the
* top bit is set . The top bit of the block size member of the BlockLink_t
* top bit is set . The top bit of the block size member of the BlockLink_t