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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-03-31 16:17:48 +03:00 committed by Jouni Malinen
parent af851914f8
commit c4b45c60ad

View File

@ -192,26 +192,31 @@ int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
if (params->subject_match) { if (params->subject_match) {
wpa_printf(MSG_INFO, "TLS: subject_match not supported"); wpa_printf(MSG_INFO, "TLS: subject_match not supported");
tlsv1_cred_free(cred);
return -1; return -1;
} }
if (params->altsubject_match) { if (params->altsubject_match) {
wpa_printf(MSG_INFO, "TLS: altsubject_match not supported"); wpa_printf(MSG_INFO, "TLS: altsubject_match not supported");
tlsv1_cred_free(cred);
return -1; return -1;
} }
if (params->suffix_match) { if (params->suffix_match) {
wpa_printf(MSG_INFO, "TLS: suffix_match not supported"); wpa_printf(MSG_INFO, "TLS: suffix_match not supported");
tlsv1_cred_free(cred);
return -1; return -1;
} }
if (params->domain_match) { if (params->domain_match) {
wpa_printf(MSG_INFO, "TLS: domain_match not supported"); wpa_printf(MSG_INFO, "TLS: domain_match not supported");
tlsv1_cred_free(cred);
return -1; return -1;
} }
if (params->openssl_ciphers) { 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; return -1;
} }