summaryrefslogtreecommitdiffstats
path: root/libvncclient/tls_openssl.c
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2012-04-15 17:17:12 +0200
committerChristian Beier <dontmind@freeshell.org>2012-04-15 17:17:12 +0200
commitf606179c9cd8c80b7ee6a3f858a674de2c455d1d (patch)
treefb4f3dbdbcb764d82059294d8e8d223c0dbf4546 /libvncclient/tls_openssl.c
parent77286f0831bbff0a3828f1987aa279ae9178619c (diff)
downloadlibtdevnc-f606179c9cd8c80b7ee6a3f858a674de2c455d1d.tar.gz
libtdevnc-f606179c9cd8c80b7ee6a3f858a674de2c455d1d.zip
LibVNCClient: properly free the openssl session stuff on shutdown.
Diffstat (limited to 'libvncclient/tls_openssl.c')
-rw-r--r--libvncclient/tls_openssl.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/libvncclient/tls_openssl.c b/libvncclient/tls_openssl.c
index 88e31f5..b6df946 100644
--- a/libvncclient/tls_openssl.c
+++ b/libvncclient/tls_openssl.c
@@ -568,19 +568,20 @@ void FreeTLS(rfbClient* client)
{
int i;
- if (mutex_buf == NULL)
- return (0);
-
- CRYPTO_set_dynlock_create_callback(NULL);
- CRYPTO_set_dynlock_lock_callback(NULL);
- CRYPTO_set_dynlock_destroy_callback(NULL);
-
- CRYPTO_set_locking_callback(NULL);
- CRYPTO_set_id_callback(NULL);
+ if (mutex_buf != NULL) {
+ CRYPTO_set_dynlock_create_callback(NULL);
+ CRYPTO_set_dynlock_lock_callback(NULL);
+ CRYPTO_set_dynlock_destroy_callback(NULL);
+
+ CRYPTO_set_locking_callback(NULL);
+ CRYPTO_set_id_callback(NULL);
+
+ for (i = 0; i < CRYPTO_num_locks(); i++)
+ pthread_mutex_destroy(&mutex_buf[i]);
+ free(mutex_buf);
+ mutex_buf = NULL;
+ }
- for (i = 0; i < CRYPTO_num_locks(); i++)
- pthread_mutex_destroy(&mutex_buf[i]);
- free(mutex_buf);
- mutex_buf = NULL;
+ SSL_free(client->tlsSession);
}