fix the magic issue in allocated memory block.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1344 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
baf5e4143c
commit
96c53b4957
|
@ -279,7 +279,6 @@ void *rt_malloc(rt_size_t size)
|
||||||
|
|
||||||
/* create mem2 struct */
|
/* create mem2 struct */
|
||||||
mem2 = (struct heap_mem *)&heap_ptr[ptr2];
|
mem2 = (struct heap_mem *)&heap_ptr[ptr2];
|
||||||
mem2->magic = HEAP_MAGIC;
|
|
||||||
mem2->used = 0;
|
mem2->used = 0;
|
||||||
mem2->next = mem->next;
|
mem2->next = mem->next;
|
||||||
mem2->prev = ptr;
|
mem2->prev = ptr;
|
||||||
|
@ -312,6 +311,8 @@ void *rt_malloc(rt_size_t size)
|
||||||
if (max_mem < used_mem) max_mem = used_mem;
|
if (max_mem < used_mem) max_mem = used_mem;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
/* set memory block magic */
|
||||||
|
mem->magic = HEAP_MAGIC;
|
||||||
|
|
||||||
if (mem == lfree)
|
if (mem == lfree)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue