From ae82631be17ca8c49d356510c9e7709ddcf19db3 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 9 Dec 2024 20:49:57 +0100 Subject: [PATCH] Fix memory leak in ntlm_support Not really important but prevents running the NTLM t_client tests with ASAN enabled. Change-Id: If472398d4ff8323de485f084a07160b365dfc501 Signed-off-by: Frank Lichtenheld Acked-by: Lev Stipakov Message-Id: <20241209194957.358-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30049.html Signed-off-by: Gert Doering --- tests/ntlm_support.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/ntlm_support.c b/tests/ntlm_support.c index ccf89624496..18d555ab3bf 100644 --- a/tests/ntlm_support.c +++ b/tests/ntlm_support.c @@ -33,11 +33,11 @@ int main(void) { +#ifdef NTLM #if defined(ENABLE_CRYPTO_OPENSSL) - crypto_load_provider("legacy"); - crypto_load_provider("default"); + provider_t *legacy = crypto_load_provider("legacy"); + provider_t *def = crypto_load_provider("default"); #endif -#ifdef NTLM if (!md_valid("MD4")) { msg(M_FATAL, "MD4 not supported"); @@ -46,6 +46,10 @@ main(void) { msg(M_FATAL, "MD5 not supported"); } +#if defined(ENABLE_CRYPTO_OPENSSL) + crypto_unload_provider("legacy", legacy); + crypto_unload_provider("default", def); +#endif #else /* ifdef NTLM */ msg(M_FATAL, "NTLM support not compiled in"); #endif