freemyipod r571 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r570‎ | r571 | r572 >
Date:01:43, 8 February 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Fix a critical bug in realloc
Modified paths:
  • /emcore/trunk/malloc.c (modified) (history)

Diff [purge]

Index: emcore/trunk/malloc.c
@@ -57,7 +57,7 @@
5858 {
5959 mutex_lock(&malloc_mutex, TIMEOUT_BLOCK);
6060 size_t oldsize = tlsf_block_size(ptr);
61 - struct scheduler_thread* owner = *((struct scheduler_thread**)(ptr + size - 4));
 61+ struct scheduler_thread* owner = *((struct scheduler_thread**)(ptr + oldsize - 4));
6262 ptr = tlsf_realloc(global_mallocpool, ptr, size + 4);
6363 if (ptr)
6464 {