diff options
author | Khem Raj <kraj@mvista.com> | 2008-10-11 08:52:58 +0000 |
---|---|---|
committer | Khem Raj <kraj@mvista.com> | 2008-10-11 08:52:58 +0000 |
commit | 6494060312de389feb65ad32bb411fcc64e821b7 (patch) | |
tree | b2c735bba6b667b8cf056a858dc216c14590c138 /libc/stdlib/malloc/realloc.c | |
parent | 47b2dbaaac9757496eb9d419e1912250354d30d1 (diff) |
Fix bug 4994 hangs on read(). I have tested the patch extensibly on ARM/LT.old.
Thank you Chase Douglas for reporting it and for the patch.
Diffstat (limited to 'libc/stdlib/malloc/realloc.c')
-rw-r--r-- | libc/stdlib/malloc/realloc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index 948326762..b3b5bae14 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -59,9 +59,9 @@ realloc (void *mem, size_t new_size) { size_t extra = new_size - size; - __heap_lock (&__malloc_heap); - extra = __heap_alloc_at (&__malloc_heap, base_mem + size, extra); - __heap_unlock (&__malloc_heap); + __pthread_mutex_lock (&__malloc_heap_lock); + extra = __heap_alloc_at (__malloc_heap, base_mem + size, extra); + __pthread_mutex_unlock (&__malloc_heap_lock); if (extra) /* Record the changed size. */ @@ -82,9 +82,9 @@ realloc (void *mem, size_t new_size) else if (new_size + MALLOC_REALLOC_MIN_FREE_SIZE <= size) /* Shrink the block. */ { - __heap_lock (&__malloc_heap); - __heap_free (&__malloc_heap, base_mem + new_size, size - new_size); - __heap_unlock (&__malloc_heap); + __pthread_mutex_lock (&__malloc_heap_lock); + __heap_free (__malloc_heap, base_mem + new_size, size - new_size); + __pthread_mutex_unlock (&__malloc_heap_lock); MALLOC_SET_SIZE (base_mem, new_size); } |