Merge pull request #413 from grissiom/fix-memheap

memheap: check against over written in rt_memheap_free
This commit is contained in:
Bernard Xiong 2015-01-16 15:09:40 +08:00
commit 2475568190
1 changed files with 2 additions and 0 deletions

View File

@ -517,6 +517,8 @@ void rt_memheap_free(void *ptr)
/* check 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 */
heap = header_ptr->pool_ptr;