summaryrefslogtreecommitdiff
path: root/regress/lib
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2021-04-04 16:19:48 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2021-04-04 16:19:48 +0000
commita72e9df4352822b068bff441d78aeb2ed754bdcf (patch)
tree4288dc8bbcec178d0083ac4f9c47e1912604a42a /regress/lib
parenta7c1e85aeaacf510f69a93a50afb4afa9e5eb5fd (diff)
Clean up client and server tls{,_config} contexts in tls_test().
Leaks reported by Ilya Shipitsin.
Diffstat (limited to 'regress/lib')
-rw-r--r--regress/lib/libtls/tls/tlstest.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/regress/lib/libtls/tls/tlstest.c b/regress/lib/libtls/tls/tlstest.c
index 047f9054f80..146842316f5 100644
--- a/regress/lib/libtls/tls/tlstest.c
+++ b/regress/lib/libtls/tls/tlstest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tlstest.c,v 1.12 2020/07/04 09:07:02 jsing Exp $ */
+/* $OpenBSD: tlstest.c,v 1.13 2021/04/04 16:19:47 tb Exp $ */
/*
* Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
*
@@ -297,6 +297,7 @@ test_tls(char *client_protocols, char *server_protocols, char *ciphers)
struct tls_config *client_cfg, *server_cfg;
struct tls *client, *server;
uint32_t protocols;
+ int failure = 0;
if ((client = tls_client()) == NULL)
errx(1, "failed to create tls client");
@@ -332,7 +333,15 @@ test_tls(char *client_protocols, char *server_protocols, char *ciphers)
if (tls_configure(server, server_cfg) == -1)
errx(1, "failed to configure server: %s", tls_error(server));
- return test_tls_cbs(client, server);
+ tls_config_free(client_cfg);
+ tls_config_free(server_cfg);
+
+ failure |= test_tls_cbs(client, server);
+
+ tls_free(client);
+ tls_free(server);
+
+ return (failure);
}
static int