From: Jorge Pereira Date: Mon, 3 Apr 2023 19:05:34 +0000 (-0300) Subject: Fix missing phtread destroy (#4957) X-Git-Tag: release_3_2_3~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e614847d56f2c14e83ab2f7a6b7d158418f20b3;p=thirdparty%2Ffreeradius-server.git Fix missing phtread destroy (#4957) As we are calling pthread_mutex_init(), we should call pthread_mutex_destroy() to release all initialized mutexs. --- 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