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:
bernard.xiong 2011-03-24 06:09:58 +00:00
parent baf5e4143c
commit 96c53b4957
1 changed files with 11 additions and 10 deletions

View File

@ -279,7 +279,6 @@ 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;
@ -312,6 +311,8 @@ void *rt_malloc(rt_size_t size)
if (max_mem < used_mem) max_mem = used_mem;
#endif
}
/* set memory block magic */
mem->magic = HEAP_MAGIC;
if (mem == lfree)
{