mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +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;
|
size_t mask = alignment - 1;
|
||||||
/* Ensure that blocks are always aligned to the required number of bytes. */
|
/* Ensure that blocks are always aligned to the required number of bytes. */
|
||||||
#if portBYTE_ALIGNMENT != 1
|
#if portBYTE_ALIGNMENT != 1
|
||||||
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
if( xWantedSize & mask )
|
||||||
{
|
{
|
||||||
/* Byte alignment required. */
|
/* Byte alignment required. */
|
||||||
xWantedSize += ( alignment - ( xWantedSize & mask ) );
|
xWantedSize += ( alignment - ( xWantedSize & mask ) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user