summaryrefslogtreecommitdiff
path: root/src/test/test_tortls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-12-18 09:58:14 -0500
committerNick Mathewson <nickm@torproject.org>2015-12-18 09:58:14 -0500
commit2e74d182b2a10a32efd7203e9e430d9b431397c8 (patch)
treea96d75177ef23c9b949cb58ec085b8b1314c4d77 /src/test/test_tortls.c
parent6598581d8163516f4879f5cb3c563dae10de80d1 (diff)
downloadtor-2e74d182b2a10a32efd7203e9e430d9b431397c8.tar.gz
tor-2e74d182b2a10a32efd7203e9e430d9b431397c8.zip
Fix remaining memory leaks in unit tests.
Diffstat (limited to 'src/test/test_tortls.c')
-rw-r--r--src/test/test_tortls.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index 8602d9ef15..1bb70ada90 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -1128,7 +1128,9 @@ test_tortls_check_lifetime(void *ignored)
ret = tor_tls_check_lifetime(LOG_WARN, tls, 0, 0);
tt_int_op(ret, OP_EQ, 0);
+ ASN1_STRING_free(validCert->cert_info->validity->notBefore);
validCert->cert_info->validity->notBefore = ASN1_TIME_set(NULL, now-10);
+ ASN1_STRING_free(validCert->cert_info->validity->notAfter);
validCert->cert_info->validity->notAfter = ASN1_TIME_set(NULL, now+60);
ret = tor_tls_check_lifetime(LOG_WARN, tls, 0, -1000);
@@ -1454,17 +1456,21 @@ test_tortls_try_to_extract_certs_from_tls(void *ignored)
try_to_extract_certs_from_tls(LOG_WARN, tls, &cert, &id_cert);
tt_assert(cert == c1);
tt_assert(!id_cert);
+ X509_free(cert); /* decrease refcnt */
sess->cert_chain = sk_X509_new_null();
try_to_extract_certs_from_tls(LOG_WARN, tls, &cert, &id_cert);
tt_assert(cert == c1);
tt_assert(!id_cert);
+ X509_free(cert); /* decrease refcnt */
sk_X509_push(sess->cert_chain, c1);
sk_X509_push(sess->cert_chain, c2);
try_to_extract_certs_from_tls(LOG_WARN, tls, &cert, &id_cert);
tt_assert(cert == c1);
tt_assert(id_cert);
+ X509_free(cert); /* decrease refcnt */
+ X509_free(id_cert); /* decrease refcnt */
done:
sk_X509_free(sess->cert_chain);
@@ -1472,6 +1478,8 @@ test_tortls_try_to_extract_certs_from_tls(void *ignored)
tor_free(tls->ssl->session);
tor_free(tls->ssl);
tor_free(tls);
+ X509_free(c1);
+ X509_free(c2);
}
#endif