Skip to content

Commit 2475568

Browse files
committed
Merge pull request #413 from grissiom/fix-memheap
memheap: check against over written in rt_memheap_free
2 parents 571095e + f8c171d commit 2475568

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/memheap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ void rt_memheap_free(void *ptr)
517517

518518
/* check magic */
519519
RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC);
520+
/* check whether this block of memory has been over-written. */
521+
RT_ASSERT((header_ptr->next->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC);
520522

521523
/* get pool ptr */
522524
heap = header_ptr->pool_ptr;

0 commit comments

Comments
 (0)