From c4b45c60addcc5f1f919b8401b1ae05a51f7d9f0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 31 Mar 2015 16:17:48 +0300 Subject: [PATCH] TLS: Fix memory leaks on tls_connection_set_params() error paths The internal TLS implementation started rejecting number of unsupported configuration parameters recently, but those new error paths did not free the allocated tlsv1_credentials buffer. Signed-off-by: Jouni Malinen --- src/crypto/tls_internal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/crypto/tls_internal.c b/src/crypto/tls_internal.c index 19a2d5a99..afd46953f 100644 --- a/src/crypto/tls_internal.c +++ b/src/crypto/tls_internal.c @@ -192,26 +192,31 @@ int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn, if (params->subject_match) { wpa_printf(MSG_INFO, "TLS: subject_match not supported"); + tlsv1_cred_free(cred); return -1; } if (params->altsubject_match) { wpa_printf(MSG_INFO, "TLS: altsubject_match not supported"); + tlsv1_cred_free(cred); return -1; } if (params->suffix_match) { wpa_printf(MSG_INFO, "TLS: suffix_match not supported"); + tlsv1_cred_free(cred); return -1; } if (params->domain_match) { wpa_printf(MSG_INFO, "TLS: domain_match not supported"); + tlsv1_cred_free(cred); return -1; } if (params->openssl_ciphers) { - wpa_printf(MSG_INFO, "GnuTLS: openssl_ciphers not supported"); + wpa_printf(MSG_INFO, "TLS: openssl_ciphers not supported"); + tlsv1_cred_free(cred); return -1; }