[tor-commits] [tor/master] More memory leaks closed in test_tortls
nickm at torproject.org
nickm at torproject.org
Wed Oct 21 18:30:36 UTC 2015
commit 13ff8e31bacc249c3d899387cbdc7cecca0ad8a3
Author: Nick Mathewson <nickm at torproject.org>
Date: Wed Oct 21 14:19:43 2015 -0400
More memory leaks closed in test_tortls
---
src/test/test_tortls.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index cbd91b4..c1d1add 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -229,6 +229,7 @@ test_tortls_get_state_description(void *ignored)
tor_tls_get_state_description(NULL, buf, 20);
tt_str_op(buf, OP_EQ, "(No SSL object)");
+ SSL_free(tls->ssl);
tls->ssl = NULL;
tor_tls_get_state_description(tls, buf, 20);
tt_str_op(buf, OP_EQ, "(No SSL object)");
@@ -2485,6 +2486,7 @@ test_tortls_finish_handshake(void *ignored)
X509 *c1 = read_cert_from(validCertString);
X509 *c2 = read_cert_from(caCertString);
+ SESS_CERT_local *sess = NULL;
ctx = SSL_CTX_new(method);
@@ -2514,7 +2516,7 @@ test_tortls_finish_handshake(void *ignored)
tls->isServer = 0;
- SESS_CERT_local *sess = tor_malloc_zero(sizeof(SESS_CERT_local));
+ sess = tor_malloc_zero(sizeof(SESS_CERT_local));
tls->ssl->session->sess_cert = (void *)sess;
sess->cert_chain = sk_X509_new_null();
sk_X509_push(sess->cert_chain, c1);
@@ -2541,10 +2543,16 @@ test_tortls_finish_handshake(void *ignored)
tt_int_op(ret, OP_EQ, -9);
done:
- if (tls)
- SSL_free(tls->ssl);
+ if (sess)
+ sk_X509_free(sess->cert_chain);
+ if (tls->ssl && tls->ssl->session) {
+ tor_free(tls->ssl->session->sess_cert);
+ }
+ SSL_free(tls->ssl);
tor_free(tls);
SSL_CTX_free(ctx);
+ tor_free(method);
+ X509_free(c1);
}
#endif
More information about the tor-commits
mailing list