aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_x509.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-05 08:30:35 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-05 08:30:35 -0400
commit3b61bdb5aebe3890443e39eed4d79da93aa19c8b (patch)
tree946b5a25ea856d027319d07cf7eaa6f1eebea4aa /src/test/test_x509.c
parent03efb67b42ce88ca6073eadc1b66d6151d646607 (diff)
downloadtor-3b61bdb5aebe3890443e39eed4d79da93aa19c8b.tar.gz
tor-3b61bdb5aebe3890443e39eed4d79da93aa19c8b.zip
Try to fix new coverity warnings in unit tests.
Diffstat (limited to 'src/test/test_x509.c')
-rw-r--r--src/test/test_x509.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/test_x509.c b/src/test/test_x509.c
index 4f814129e5..9128958492 100644
--- a/src/test/test_x509.c
+++ b/src/test/test_x509.c
@@ -91,9 +91,11 @@ test_x509_consume_ec_cert(void *arg)
"+FSPvQIhAM7kY9Tlt0ELmyMnORPp1VJieXn/qhL5VoxGxSedTbny\n";
const time_t now = 1535045321; /* when I'm writing this test. */
tor_x509_cert_t *cert = cert_from_der64(certificate);
+ crypto_pk_t *key = NULL;
tt_assert(cert);
- tt_ptr_op(NULL, OP_EQ, tor_tls_cert_get_key(cert));
+ key = tor_tls_cert_get_key(cert);
+ tt_ptr_op(NULL, OP_EQ, key); // Can't get an RSA key out of an EC cert.
/* It's a self-signed cert -- make sure it signed itself. */
tt_assert(tor_tls_cert_is_valid(LOG_ERR, cert, cert, now, 0));
@@ -105,6 +107,7 @@ test_x509_consume_ec_cert(void *arg)
done:
tor_x509_cert_free(cert);
+ crypto_pk_free(key);
teardown_capture_of_logs();
}