mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
eap-tls: Fix potential memory leak
client-cert might be leaked if ClientKey loading fails
This commit is contained in:
parent
f7df7939e6
commit
2b2b6185e4
@ -366,7 +366,7 @@ static bool eap_tls_settings_load(struct eap_state *eap,
|
||||
client_cert = eap_tls_load_client_cert(settings, value,
|
||||
passphrase, NULL);
|
||||
if (!client_cert)
|
||||
goto load_error;
|
||||
goto bad_client_cert;
|
||||
}
|
||||
|
||||
l_free(value);
|
||||
@ -377,7 +377,7 @@ static bool eap_tls_settings_load(struct eap_state *eap,
|
||||
client_key = eap_tls_load_priv_key(settings, value,
|
||||
passphrase, NULL);
|
||||
if (!client_key)
|
||||
goto load_error;
|
||||
goto bad_client_key;
|
||||
}
|
||||
|
||||
l_free(value);
|
||||
@ -390,15 +390,17 @@ static bool eap_tls_settings_load(struct eap_state *eap,
|
||||
&client_cert,
|
||||
&client_key, NULL) ||
|
||||
!client_cert || !client_key)) {
|
||||
l_certchain_free(client_cert);
|
||||
l_key_free(client_key);
|
||||
goto load_error;
|
||||
goto bad_bundle;
|
||||
}
|
||||
|
||||
eap_tls_common_set_keys(eap, client_cert, client_key);
|
||||
return true;
|
||||
|
||||
load_error:
|
||||
bad_bundle:
|
||||
l_key_free(client_key);
|
||||
bad_client_key:
|
||||
l_certchain_free(client_cert);
|
||||
bad_client_cert:
|
||||
eap_tls_common_state_free(eap);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user