diff options
author | Jason Evans <je@facebook.com> | 2010-07-22 18:35:59 (GMT) |
---|---|---|
committer | Jason Evans <je@facebook.com> | 2010-07-22 18:35:59 (GMT) |
commit | 2541e1b083a81f29554dcba7b2eaa1cc9889219a (patch) | |
tree | 5b940524e89934f7fcafa0e236f8d5f4a5e0aa98 | |
parent | b43b7750a6e08706aeb61d83ff1e1eb0c81c910b (diff) | |
download | jemalloc-2541e1b083a81f29554dcba7b2eaa1cc9889219a.zip jemalloc-2541e1b083a81f29554dcba7b2eaa1cc9889219a.tar.gz jemalloc-2541e1b083a81f29554dcba7b2eaa1cc9889219a.tar.bz2 |
Add a missing mutex unlock in malloc_init_hard().
If multiple threads race to initialize malloc, the loser(s) busy-wait
until initialization is complete. Add a missing mutex lock so that the
loser(s) properly release the initialization mutex. Under some
race conditions, this flaw could have caused one or more threads to
become permanently blocked.
Reported by Terrell Magee.
-rw-r--r-- | jemalloc/src/jemalloc.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c index bf2ace3..b36590d 100644 --- a/jemalloc/src/jemalloc.c +++ b/jemalloc/src/jemalloc.c @@ -324,6 +324,7 @@ malloc_init_hard(void) CPU_SPINWAIT; malloc_mutex_lock(&init_lock); } while (malloc_initialized == false); + malloc_mutex_unlock(&init_lock); return (false); } |