From 2e38079531bdc3d5cd55f6eb5f31e203cd2823c3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 31 Oct 2015 18:15:22 +0200 Subject: [PATCH] TLS: Fix memory leak with multiple TLS server instances When using CONFIG_TLS=internal and starting hostapd with multiple configuration files that each initialize TLS server, the server certificate and related data was not freed for all the interfaces on exit path. Fix this by freeing the credential data that is stored separately for each call to tls_init(). Signed-off-by: Jouni Malinen --- src/crypto/tls_internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/crypto/tls_internal.c b/src/crypto/tls_internal.c index 704751d30..1b82245e0 100644 --- a/src/crypto/tls_internal.c +++ b/src/crypto/tls_internal.c @@ -64,10 +64,12 @@ void tls_deinit(void *ssl_ctx) tlsv1_client_global_deinit(); #endif /* CONFIG_TLS_INTERNAL_CLIENT */ #ifdef CONFIG_TLS_INTERNAL_SERVER - tlsv1_cred_free(global->server_cred); tlsv1_server_global_deinit(); #endif /* CONFIG_TLS_INTERNAL_SERVER */ } +#ifdef CONFIG_TLS_INTERNAL_SERVER + tlsv1_cred_free(global->server_cred); +#endif /* CONFIG_TLS_INTERNAL_SERVER */ os_free(global); }