3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

eap-ttls: Fix memory leak

A very unlikely condition could result in struct phase2_method being
leaked.
This commit is contained in:
Tim Kourt 2019-10-15 10:34:11 -07:00 committed by Denis Kenzior
parent 6917f75c6a
commit 34cd8d5f3e

View File

@ -1089,7 +1089,7 @@ static bool eap_ttls_settings_load(struct eap_state *eap,
struct l_settings *settings, struct l_settings *settings,
const char *prefix) const char *prefix)
{ {
struct phase2_method *phase2 = l_new(struct phase2_method, 1); struct phase2_method *phase2;
const char *phase2_method_name; const char *phase2_method_name;
char setting[72]; char setting[72];
uint8_t i; uint8_t i;
@ -1100,6 +1100,8 @@ static bool eap_ttls_settings_load(struct eap_state *eap,
if (!phase2_method_name) if (!phase2_method_name)
return false; return false;
phase2 = l_new(struct phase2_method, 1);
snprintf(setting, sizeof(setting), "%sTTLS-Phase2-", prefix); snprintf(setting, sizeof(setting), "%sTTLS-Phase2-", prefix);
for (i = 0; tunneled_non_eap_method_ops[i].name; i++) { for (i = 0; tunneled_non_eap_method_ops[i].name; i++) {