3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

network: Close settings if ineligible for autoconnect

This commit is contained in:
Denis Kenzior 2016-09-21 14:35:30 -05:00
parent 7661f1b7c0
commit 954f4ebca2

View File

@ -373,13 +373,16 @@ int network_autoconnect(struct network *network, struct scan_bss *bss)
psk = l_settings_get_value(network->settings, "Security",
"PreSharedKey");
if (!psk)
if (!psk) {
network_settings_close(network);
return -ENOKEY;
}
l_free(network->psk);
network->psk = l_util_from_hexstring(psk, &len);
if (network->psk && len != 32) {
network_settings_close(network);
l_free(network->psk);
network->psk = NULL;
return -ENOKEY;