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 <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-10-31 18:15:22 +02:00
parent a63ebc159d
commit 2e38079531

View file

@ -64,10 +64,12 @@ void tls_deinit(void *ssl_ctx)
tlsv1_client_global_deinit(); tlsv1_client_global_deinit();
#endif /* CONFIG_TLS_INTERNAL_CLIENT */ #endif /* CONFIG_TLS_INTERNAL_CLIENT */
#ifdef CONFIG_TLS_INTERNAL_SERVER #ifdef CONFIG_TLS_INTERNAL_SERVER
tlsv1_cred_free(global->server_cred);
tlsv1_server_global_deinit(); tlsv1_server_global_deinit();
#endif /* CONFIG_TLS_INTERNAL_SERVER */ #endif /* CONFIG_TLS_INTERNAL_SERVER */
} }
#ifdef CONFIG_TLS_INTERNAL_SERVER
tlsv1_cred_free(global->server_cred);
#endif /* CONFIG_TLS_INTERNAL_SERVER */
os_free(global); os_free(global);
} }