From 1e614847d56f2c14e83ab2f7a6b7d158418f20b3 Mon Sep 17 00:00:00 2001 From: Jorge Pereira Date: Mon, 3 Apr 2023 16:05:34 -0300 Subject: [PATCH] Fix missing phtread destroy (#4957) As we are calling pthread_mutex_init(), we should call pthread_mutex_destroy() to release all initialized mutexs. --- src/main/threads.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/threads.c b/src/main/threads.c index 0e3ace515d..bd5537e831 100644 --- a/src/main/threads.c +++ b/src/main/threads.c @@ -289,8 +289,16 @@ int tls_mutexes_init(void) static void tls_mutexes_destroy(void) { - CRYPTO_set_locking_callback(NULL); + int i, num; + + num = CRYPTO_num_locks(); + + for (i = 0; i < num; i++) { + pthread_mutex_destroy(&ssl_mutexes[i]); + } free(ssl_mutexes); + + CRYPTO_set_locking_callback(NULL); } #else #define tls_mutexes_destroy -- 2.47.2