From: Willy Tarreau Date: Thu, 22 Jul 2021 12:42:32 +0000 (+0200) Subject: BUILD: threads: fix pthread_mutex_unlock when !USE_THREAD X-Git-Tag: v2.5-dev3~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3c4a8f59d5a7d235fc5a4e447f2f8351718df9d;p=thirdparty%2Fhaproxy.git BUILD: threads: fix pthread_mutex_unlock when !USE_THREAD Commit 048368ef6 ("MINOR: deinit: always deinit the init_mutex on failed initialization") added the missing unlock but forgot to condition it on USE_THREAD, resulting in a build failure. No backport is needed. This addresses oss-fuzz issue 36426. --- diff --git a/src/haproxy.c b/src/haproxy.c index 5d3d928694..d09f15c85a 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2740,7 +2740,9 @@ static void *run_thread_poll_loop(void *data) list_for_each_entry(ptaf, &per_thread_alloc_list, list) { if (!ptaf->fct()) { ha_alert("failed to allocate resources for thread %u.\n", tid); +#ifdef USE_THREAD pthread_mutex_unlock(&init_mutex); +#endif exit(1); } } @@ -2752,7 +2754,9 @@ static void *run_thread_poll_loop(void *data) list_for_each_entry(ptif, &per_thread_init_list, list) { if (!ptif->fct()) { ha_alert("failed to initialize thread %u.\n", tid); +#ifdef USE_THREAD pthread_mutex_unlock(&init_mutex); +#endif exit(1); } }