diff --git a/portable/MemMang/heap_5.c b/portable/MemMang/heap_5.c index bf321304f..a54381b0c 100644 --- a/portable/MemMang/heap_5.c +++ b/portable/MemMang/heap_5.c @@ -284,7 +284,14 @@ void * pvPortMalloc( size_t xWantedSize ) { pxPreviousBlock = pxBlock; pxBlock = heapPROTECT_BLOCK_POINTER( pxBlock->pxNextFreeBlock ); - heapVALIDATE_BLOCK_POINTER( pxBlock ); + + /* pxEnd is the end marker of the free list. It is located at + * pucHeapHighAddress and is not part of the usable heap, so it + * must be excluded from the heap block pointer validation. */ + if( pxBlock != pxEnd ) + { + heapVALIDATE_BLOCK_POINTER( pxBlock ); + } } /* If the end marker was reached then a block of adequate size