diff --git a/src/network.c b/src/network.c index e5d1fb1e..7a0895da 100644 --- a/src/network.c +++ b/src/network.c @@ -427,17 +427,22 @@ static int network_load_psk(struct network *network) void network_sync_psk(struct network *network) { char *hex; + struct l_settings *fs_settings; if (!network->update_psk) return; network->update_psk = false; + + fs_settings = storage_network_open(SECURITY_PSK, network->info->ssid); hex = l_util_hexstring(network->psk, 32); l_settings_set_value(network->settings, "Security", "PreSharedKey", hex); + l_settings_set_value(fs_settings, "Security", "PreSharedKey", hex); l_free(hex); - storage_network_sync(SECURITY_PSK, network->info->ssid, - network->settings); + + storage_network_sync(SECURITY_PSK, network->info->ssid, fs_settings); + l_settings_free(fs_settings); } int network_autoconnect(struct network *network, struct scan_bss *bss)