diff options
| author | Grissiom <[email protected]> | 2015-04-08 16:37:10 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2015-04-08 16:39:50 +0800 |
| commit | 2d3b2f1e9466b7759ab2a663a2b56e49e3f9852d (patch) | |
| tree | f9b6ef9dfabdbc53dd8ca42ecc41abbe2a952c27 /src | |
| parent | 1c38f85b9b10b6880cf090c44564782cbe6279a8 (diff) | |
memheap: check the USED bit in rt_memheap_free
This will ease the debugging of double-free bug.
Diffstat (limited to 'src')
| -rw-r--r-- | src/memheap.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/memheap.c b/src/memheap.c index adb5c86053..86e4461675 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -517,6 +517,7 @@ void rt_memheap_free(void *ptr) /* check magic */ RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC); + RT_ASSERT(header_ptr->magic & RT_MEMHEAP_USED); /* check whether this block of memory has been over-written. */ RT_ASSERT((header_ptr->next->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC); |
