summaryrefslogtreecommitdiffstats
path: root/test/sslapitest.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-09-26 12:04:23 +0100
committerMatt Caswell <matt@openssl.org>2016-09-26 17:26:50 +0100
commitfa454945cf2855fed452ff9bdb1876096bc07beb (patch)
treeaa3e9b327ddc92d18110629b09d1d3c0691a7c57 /test/sslapitest.c
parent8ff70f3326983360c6f6306a1cd2238ef92d1f26 (diff)
Fix some mem leaks in sslapitest
A mem leak could occur on an error path. Also the mempacket BIO_METHOD needs to be cleaned up, because of the newly added DTLS test. Also fixed a double semi-colon in ssltestlib.c Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test/sslapitest.c')
-rw-r--r--test/sslapitest.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/sslapitest.c b/test/sslapitest.c
index acb2087cc4..b08eb8c78f 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -46,14 +46,18 @@ static int execute_test_large_message(const SSL_METHOD *smeth,
goto end;
}
chaincert = PEM_read_bio_X509(certbio, NULL, NULL, NULL);
+ BIO_free(certbio);
+ certbio = NULL;
+ if (chaincert == NULL) {
+ printf("Unable to load certificate for chain\n");
+ goto end;
+ }
if (!create_ssl_ctx_pair(smeth, cmeth, &sctx,
&cctx, cert, privkey)) {
printf("Unable to create SSL_CTX pair\n");
goto end;
}
- BIO_free(certbio);
- certbio = NULL;
/*
* We assume the supplied certificate is big enough so that if we add
@@ -870,6 +874,8 @@ int main(int argc, char *argv[])
testresult = run_tests(argv[0]);
+ bio_s_mempacket_test_free();
+
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (CRYPTO_mem_leaks(err) <= 0)
testresult = 1;