memheap: check against over written in rt_memheap_free

This commit is contained in:
Grissiom 2015-01-16 11:41:20 +08:00
parent 571095e84c
commit f8c171d5ad
1 changed files with 2 additions and 0 deletions

View File

@ -517,6 +517,8 @@ void rt_memheap_free(void *ptr)
/* check magic */ /* check magic */
RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC); RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC);
/* check whether this block of memory has been over-written. */
RT_ASSERT((header_ptr->next->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC);
/* get pool ptr */ /* get pool ptr */
heap = header_ptr->pool_ptr; heap = header_ptr->pool_ptr;