code snippet starts
static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert ){
xBlockLink *pxIterator;
unsigned char *puc; /* Iterate through the list until a block is found that has a higher address
than the block being inserted. */
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock )
{
/* Nothing to do here, just iterate to the right position. */
}
code snippet ends. I have attached my debugger screen shot when this infinite loop encountered. You can see all the values in it. I have allocated heap size as 20480 bytes, on PIC24FJ256GB206. Free mem at that time was 9684 bytes. I log free memory when I free chunk to heap. I think, these should be check, if next block is null. Please confirm.