mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
LP-37 Fix alignment bug in in pvPortMallocGeneric
The allocation size was incremented by 'alignment' bytes when 'xWantedSize' was 'alignment' aligned, but not 'portBYTE_ALIGNMENT' aligned.
This commit is contained in:
parent
24c144ca69
commit
d57e838ab1
@ -103,7 +103,7 @@ static uint8_t *pucAlignedHeap = NULL;
|
||||
size_t mask = alignment - 1;
|
||||
/* Ensure that blocks are always aligned to the required number of bytes. */
|
||||
#if portBYTE_ALIGNMENT != 1
|
||||
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
||||
if( xWantedSize & mask )
|
||||
{
|
||||
/* Byte alignment required. */
|
||||
xWantedSize += ( alignment - ( xWantedSize & mask ) );
|
||||
|
Loading…
Reference in New Issue
Block a user