From 1591f3f754d9e8a50d63430e81799ce6e01ef2a3 Mon Sep 17 00:00:00 2001 From: tb Date: Sun, 4 Apr 2021 16:19:47 +0000 Subject: [PATCH] Clean up client and server tls{,_config} contexts in tls_test(). Leaks reported by Ilya Shipitsin. --- regress/lib/libtls/tls/tlstest.c | 13 +++++++++++-- 1 file 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 * @@ -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 -- 2.20.1