Fix an UB of comparing pointers

The same UB with the one in heap_4.c.
This commit is contained in:
Tedlion 2026-01-29 16:09:31 +08:00 committed by GitHub
parent ec60aa00c6
commit 5eabaaaabb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -489,7 +489,8 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert ) /* PRIVI
/* Iterate through the list until a block is found that has a higher address
* than the block being inserted. */
for( pxIterator = &xStart; heapPROTECT_BLOCK_POINTER( pxIterator->pxNextFreeBlock ) < pxBlockToInsert; pxIterator = heapPROTECT_BLOCK_POINTER( pxIterator->pxNextFreeBlock ) )
for( pxIterator = &xStart; ( portPOINTER_SIZE_TYPE ) heapPROTECT_BLOCK_POINTER( pxIterator->pxNextFreeBlock ) < ( portPOINTER_SIZE_TYPE ) pxBlockToInsert;
pxIterator = heapPROTECT_BLOCK_POINTER( pxIterator->pxNextFreeBlock ) )
{
/* Nothing to do here, just iterate to the right position. */
}