From 2541e1b083a81f29554dcba7b2eaa1cc9889219a Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Thu, 22 Jul 2010 11:35:59 -0700 Subject: [PATCH] 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. --- jemalloc/src/jemalloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c index bf2ace39..b36590dd 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); }