mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-28 03:47:11 +08:00
[Kernel] mark the free mem block with HEAP_MAGIC.
This commit is contained in:
parent
d0dcdd11fe
commit
730592df19
@ -304,6 +304,7 @@ void *rt_malloc(rt_size_t size)
|
||||
|
||||
/* create mem2 struct */
|
||||
mem2 = (struct heap_mem *)&heap_ptr[ptr2];
|
||||
mem2->magic = HEAP_MAGIC;
|
||||
mem2->used = 0;
|
||||
mem2->next = mem->next;
|
||||
mem2->prev = ptr;
|
||||
@ -540,7 +541,7 @@ void rt_free(void *rmem)
|
||||
RT_ASSERT(mem->magic == HEAP_MAGIC);
|
||||
/* ... and is now unused. */
|
||||
mem->used = 0;
|
||||
mem->magic = 0;
|
||||
mem->magic = HEAP_MAGIC;
|
||||
|
||||
if (mem < lfree)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user