Use a helper function to free neighbor DB entries
There is no need to duplicate this code in multiple locations. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
96f0af07e6
commit
59951ebf09
1 changed files with 11 additions and 9 deletions
|
@ -168,6 +168,14 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void hostapd_neighbor_free(struct hostapd_neighbor_entry *nr)
|
||||||
|
{
|
||||||
|
hostapd_neighbor_clear_entry(nr);
|
||||||
|
dl_list_del(&nr->list);
|
||||||
|
os_free(nr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
|
int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
|
||||||
const struct wpa_ssid_value *ssid)
|
const struct wpa_ssid_value *ssid)
|
||||||
{
|
{
|
||||||
|
@ -177,9 +185,7 @@ int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid,
|
||||||
if (!nr)
|
if (!nr)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
hostapd_neighbor_clear_entry(nr);
|
hostapd_neighbor_free(nr);
|
||||||
dl_list_del(&nr->list);
|
|
||||||
os_free(nr);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -191,9 +197,7 @@ void hostapd_free_neighbor_db(struct hostapd_data *hapd)
|
||||||
|
|
||||||
dl_list_for_each_safe(nr, prev, &hapd->nr_db,
|
dl_list_for_each_safe(nr, prev, &hapd->nr_db,
|
||||||
struct hostapd_neighbor_entry, list) {
|
struct hostapd_neighbor_entry, list) {
|
||||||
hostapd_neighbor_clear_entry(nr);
|
hostapd_neighbor_free(nr);
|
||||||
dl_list_del(&nr->list);
|
|
||||||
os_free(nr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,9 +358,7 @@ int hostapd_neighbor_sync_own_report(struct hostapd_data *hapd)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Clear old entry due to SSID change */
|
/* Clear old entry due to SSID change */
|
||||||
hostapd_neighbor_clear_entry(nr);
|
hostapd_neighbor_free(nr);
|
||||||
dl_list_del(&nr->list);
|
|
||||||
os_free(nr);
|
|
||||||
|
|
||||||
hostapd_neighbor_set_own_report(hapd);
|
hostapd_neighbor_set_own_report(hapd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue