[git commit] malloc-standard: Add locking to malloc_trim

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Mar 18 22:11:39 UTC 2015


commit: http://git.uclibc.org/uClibc/commit/?id=be61486447ab447ac24892845af92489fe0b7148
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Closes bugzilla #4586

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 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 39e54d6..8b7a81f 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;
 }
 
 /*


More information about the uClibc-cvs mailing list