SAE: Fix resource leak on reading a separate password file

The file needs to be closed on all paths before exiting from the
function.

Fixes: e748e50c62 ("SAE passwords from a separate file")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-01-22 22:00:35 +02:00 committed by Jouni Malinen
parent 348c047afd
commit c03377cf27

View file

@ -2360,10 +2360,12 @@ static int parse_sae_password_file(struct hostapd_bss_config *bss,
wpa_printf(MSG_ERROR,
"Invalid SAE password at line %d in '%s'",
line, fname);
fclose(f);
return -1;
}
}
fclose(f);
return 0;
}