From: Eric Bollengier Date: Thu, 16 Jan 2020 16:00:46 +0000 (+0100) Subject: Fix segfault in free_tls_connection() after an authentication issue X-Git-Tag: Release-9.6.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0d62e42ea9fa2260c1b01f56a1d689e3c06d473;p=thirdparty%2Fbacula.git Fix segfault in free_tls_connection() after an authentication issue --- diff --git a/bacula/src/lib/tls.c b/bacula/src/lib/tls.c index 8e32dfbd2..523db1892 100644 --- a/bacula/src/lib/tls.c +++ b/bacula/src/lib/tls.c @@ -485,10 +485,12 @@ err: */ void free_tls_connection(TLS_CONNECTION *tls) { - pthread_mutex_destroy(&tls->rwlock); - pthread_mutex_destroy(&tls->wlock); - SSL_free(tls->openssl); - free(tls); + if (tls) { + pthread_mutex_destroy(&tls->rwlock); + pthread_mutex_destroy(&tls->wlock); + SSL_free(tls->openssl); + free(tls); + } } /* Does all the manual labor for tls_bsock_accept() and tls_bsock_connect() */