Use a shared function for freeing PSK list

There is no need to duplicate this code in multiple locations.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-11-25 18:01:55 +02:00
parent fc5550a1c2
commit f2a14be798
4 changed files with 16 additions and 21 deletions

View file

@ -55,14 +55,9 @@ struct hostapd_acl_query_data {
#ifndef CONFIG_NO_RADIUS
static void hostapd_acl_cache_free_entry(struct hostapd_cached_radius_acl *e)
{
struct hostapd_sta_wpa_psk_short *psk = e->psk;
os_free(e->identity);
os_free(e->radius_cui);
while (psk) {
struct hostapd_sta_wpa_psk_short *prev = psk;
psk = psk->next;
os_free(prev);
}
hostapd_free_psk_list(e->psk);
os_free(e);
}
@ -636,3 +631,13 @@ void hostapd_acl_deinit(struct hostapd_data *hapd)
hostapd_acl_query_free(prev);
}
}
void hostapd_free_psk_list(struct hostapd_sta_wpa_psk_short *psk)
{
while (psk) {
struct hostapd_sta_wpa_psk_short *prev = psk;
psk = psk->next;
os_free(prev);
}
}