Yet more memory leaks closed in test_tortls

This commit is contained in:
Nick Mathewson 2015-10-21 14:30:34 -04:00
parent 13ff8e31ba
commit 79b3c4a8a3

View File

@ -897,6 +897,9 @@ test_tortls_classify_client_ciphers(void *ignored)
done: done:
sk_SSL_CIPHER_free(ciphers); sk_SSL_CIPHER_free(ciphers);
SSL_free(tls->ssl);
tor_free(tls);
SSL_CTX_free(ctx);
} }
#endif #endif
@ -1299,6 +1302,7 @@ test_tortls_received_v3_certificate(void *ignored)
tor_tls_t *tls; tor_tls_t *tls;
X509 *validCert = read_cert_from(validCertString); X509 *validCert = read_cert_from(validCertString);
X509_NAME *subject=NULL, *issuer=NULL; X509_NAME *subject=NULL, *issuer=NULL;
EVP_PKEY *key = NULL;
tls = tor_malloc_zero(sizeof(tor_tls_t)); tls = tor_malloc_zero(sizeof(tor_tls_t));
tls->ssl = tor_malloc_zero(sizeof(SSL)); tls->ssl = tor_malloc_zero(sizeof(SSL));
@ -1354,7 +1358,7 @@ test_tortls_received_v3_certificate(void *ignored)
ret = tor_tls_received_v3_certificate(tls); ret = tor_tls_received_v3_certificate(tls);
tt_int_op(ret, OP_EQ, 0); tt_int_op(ret, OP_EQ, 0);
EVP_PKEY *key = X509_get_pubkey(validCert); key = X509_get_pubkey(validCert);
key->type = 5; key->type = 5;
ret = tor_tls_received_v3_certificate(tls); ret = tor_tls_received_v3_certificate(tls);
tt_int_op(ret, OP_EQ, 1); tt_int_op(ret, OP_EQ, 1);
@ -1370,6 +1374,9 @@ test_tortls_received_v3_certificate(void *ignored)
tor_free(tls->ssl->session); tor_free(tls->ssl->session);
tor_free(tls->ssl); tor_free(tls->ssl);
tor_free(tls); tor_free(tls);
X509_free(validCert);
if (key)
EVP_PKEY_free(key);
} }
#endif #endif