From a65e5e0800682eefe060a8f690d1f242ced8fd6f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 3 May 2018 12:55:57 -0500 Subject: [PATCH] eap-pwd: Don't leak on failure --- src/eap-pwd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/eap-pwd.c b/src/eap-pwd.c index 0ef077aa..6fc307fe 100644 --- a/src/eap-pwd.c +++ b/src/eap-pwd.c @@ -761,7 +761,7 @@ static bool eap_pwd_load_settings(struct eap_state *eap, if (!pwd->identity) { l_error("EAP-Identity is missing"); - return false; + goto error; } snprintf(setting, sizeof(setting), "%sPWD-Password", prefix); @@ -770,12 +770,18 @@ static bool eap_pwd_load_settings(struct eap_state *eap, if (!pwd->password) { l_error("EAP-PWD password is missing"); - return false; + goto error; } eap_set_data(eap, pwd); return true; + +error: + l_free(pwd->identity); + l_free(pwd->password); + l_free(pwd); + return false; } static struct eap_method eap_pwd = {