diff options
Diffstat (limited to 'libc/stdlib')
-rw-r--r-- | libc/stdlib/malloc-standard/free.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c index 39e54d635..8b7a81fca 100644 --- a/libc/stdlib/malloc-standard/free.c +++ b/libc/stdlib/malloc-standard/free.c @@ -104,9 +104,13 @@ static int __malloc_trim(size_t pad, mstate av) */ int malloc_trim(size_t pad) { + int r; + __MALLOC_LOCK; mstate av = get_malloc_state(); __malloc_consolidate(av); - return __malloc_trim(pad, av); + r = __malloc_trim(pad, av); + __MALLOC_UNLOCK; + return r; } /* |