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
1 changed files with 3 additions and 1 deletions

View File

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