summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-09-17 00:01:20 -0400
committerNick Mathewson <nickm@torproject.org>2009-09-17 00:01:20 -0400
commit9c38941195309c3d9a8620536f7f7246c780b9c7 (patch)
treeaec6e1cf4af9b68d7bd0653bac727c825553b3f4 /src/common
parentb3991ea7d15c18dc33d4761f61f2e90ad49ab4b8 (diff)
downloadtor-9c38941195309c3d9a8620536f7f7246c780b9c7.tar.gz
tor-9c38941195309c3d9a8620536f7f7246c780b9c7.zip
Work around a memory leak in openssl 0.9.8g (and maybe others)
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tortls.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index aeb0ca0800..c6b11e9a6e 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -829,6 +829,9 @@ tor_tls_new(int sock, int isServer)
if (!SSL_set_cipher_list(result->ssl,
isServer ? SERVER_CIPHER_LIST : CLIENT_CIPHER_LIST)) {
tls_log_errors(NULL, LOG_WARN, "setting ciphers");
+#ifdef SSL_set_tlsext_host_name
+ SSL_set_tlsext_host_name(result->ssl, NULL);
+#endif
SSL_free(result->ssl);
tor_free(result);
return NULL;
@@ -839,6 +842,9 @@ tor_tls_new(int sock, int isServer)
bio = BIO_new_socket(sock, BIO_NOCLOSE);
if (! bio) {
tls_log_errors(NULL, LOG_WARN, "opening BIO");
+#ifdef SSL_set_tlsext_host_name
+ SSL_set_tlsext_host_name(result->ssl, NULL);
+#endif
SSL_free(result->ssl);
tor_free(result);
return NULL;
@@ -919,6 +925,9 @@ tor_tls_free(tor_tls_t *tls)
if (!removed) {
log_warn(LD_BUG, "Freeing a TLS that was not in the ssl->tls map.");
}
+#ifdef SSL_set_tlsext_host_name
+ SSL_set_tlsext_host_name(tls->ssl, NULL);
+#endif
SSL_free(tls->ssl);
tls->ssl = NULL;
tls->negotiated_callback = NULL;