Skip to content

Commit c1d2e97

Browse files
committed
[Kernel] Add magic checking in rt_memheap_free routine.
1 parent 1bd91f8 commit c1d2e97

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/memheap.c

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

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

0 commit comments

Comments
 (0)