From c508d9e4df913325a2694dcb28eecf35c96b0eac Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Fri, 24 Jun 2016 05:09:05 +0200 Subject: [PATCH] device: Make sure connected network is not freed During the network_info refactoring the adding of the connected BSS to device->bss_list in case it is not in the scan results has moved to after the l_hashmap_foreach_remove call meaning that the network could be removed even though it is still pointed at by device->connected networks. Reverse the order to what it was before. Alternatively network_process network could take not of the fact the network is connected and not call network_remove on it leaving it with an empty bss_list. --- src/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/device.c b/src/device.c index b398dd05..4eac011d 100644 --- a/src/device.c +++ b/src/device.c @@ -400,8 +400,6 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, process_bss(device, bss, &now); } - l_hashmap_foreach_remove(device->networks, process_network, device); - if (device->connected_bss) { struct scan_bss *bss; @@ -420,6 +418,8 @@ static bool new_scan_results(uint32_t wiphy_id, uint32_t ifindex, device->connected_bss = bss; } + l_hashmap_foreach_remove(device->networks, process_network, device); + l_queue_destroy(device->old_bss_list, bss_free); device->old_bss_list = NULL;