]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix missing phtread destroy (#4957)
authorJorge Pereira <jpereira@users.noreply.github.com>
Mon, 3 Apr 2023 19:05:34 +0000 (16:05 -0300)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 3 Apr 2023 19:05:49 +0000 (15:05 -0400)
As we are calling pthread_mutex_init(), we should call
pthread_mutex_destroy() to release all initialized mutexs.

src/main/threads.c

index 0e3ace515d20cda4e495f501542c60621ee832be..bd5537e831ba06dc3c078f3025df73cb55b97b28 100644 (file)
@@ -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