3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-03 10:22:47 +01:00

eap-pwd: Don't leak on failure

This commit is contained in:
Denis Kenzior 2018-05-03 12:55:57 -05:00
parent 5cf358cd4f
commit a65e5e0800

View File

@ -761,7 +761,7 @@ static bool eap_pwd_load_settings(struct eap_state *eap,
if (!pwd->identity) { if (!pwd->identity) {
l_error("EAP-Identity is missing"); l_error("EAP-Identity is missing");
return false; goto error;
} }
snprintf(setting, sizeof(setting), "%sPWD-Password", prefix); snprintf(setting, sizeof(setting), "%sPWD-Password", prefix);
@ -770,12 +770,18 @@ static bool eap_pwd_load_settings(struct eap_state *eap,
if (!pwd->password) { if (!pwd->password) {
l_error("EAP-PWD password is missing"); l_error("EAP-PWD password is missing");
return false; goto error;
} }
eap_set_data(eap, pwd); eap_set_data(eap, pwd);
return true; return true;
error:
l_free(pwd->identity);
l_free(pwd->password);
l_free(pwd);
return false;
} }
static struct eap_method eap_pwd = { static struct eap_method eap_pwd = {