From: Jouni Malinen Date: Sat, 31 Oct 2015 16:15:22 +0000 (+0200) Subject: TLS: Fix memory leak with multiple TLS server instances X-Git-Tag: hostap_2_6~1427 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e38079531bdc3d5cd55f6eb5f31e203cd2823c3;p=thirdparty%2Fhostap.git 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 --- 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); }