Skip to content

Commit

Permalink
Fix bug of heap_2 introduced by pr738. (#743)
Browse files Browse the repository at this point in the history
* Fix bug of heap_2 introduced by pr738.
* Fix formatting check

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: moral-hao <405197809@qq.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
3 people authored Aug 6, 2023
1 parent 02be485 commit ee0a82b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions portable/MemMang/heap_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ void * pvPortMalloc( size_t xWantedSize )
pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;
pxBlock->xBlockSize = xWantedSize;

/* Insert the new block into the list of free blocks. */
pxNewBlockLink->pxNextFreeBlock = pxPreviousBlock->pxNextFreeBlock;
pxPreviousBlock->pxNextFreeBlock = pxNewBlockLink;
/* Insert the new block into the list of free blocks.
* The list of free blocks is sorted by their size, we have to
* iterate to find the right place to insert new block. */
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
}

xFreeBytesRemaining -= pxBlock->xBlockSize;
Expand Down

0 comments on commit ee0a82b

Please sign in to comment.