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:
parent
fc5550a1c2
commit
f2a14be798
4 changed files with 16 additions and 21 deletions
|
@ -570,11 +570,7 @@ static void handle_auth(struct hostapd_data *hapd,
|
|||
HOSTAPD_LEVEL_INFO, "VLAN ID %d", sta->vlan_id);
|
||||
}
|
||||
|
||||
while (sta->psk) {
|
||||
struct hostapd_sta_wpa_psk_short *prev = sta->psk;
|
||||
sta->psk = sta->psk->next;
|
||||
os_free(prev);
|
||||
}
|
||||
hostapd_free_psk_list(sta->psk);
|
||||
if (hapd->conf->wpa_psk_radius != PSK_RADIUS_IGNORED) {
|
||||
sta->psk = psk;
|
||||
psk = NULL;
|
||||
|
@ -655,11 +651,7 @@ static void handle_auth(struct hostapd_data *hapd,
|
|||
fail:
|
||||
os_free(identity);
|
||||
os_free(radius_cui);
|
||||
while (psk) {
|
||||
struct hostapd_sta_wpa_psk_short *prev = psk;
|
||||
psk = psk->next;
|
||||
os_free(prev);
|
||||
}
|
||||
hostapd_free_psk_list(psk);
|
||||
|
||||
send_auth_reply(hapd, mgmt->sa, mgmt->bssid, auth_alg,
|
||||
auth_transaction + 1, resp, resp_ies, resp_ies_len);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,5 +23,6 @@ int hostapd_allowed_address(struct hostapd_data *hapd, const u8 *addr,
|
|||
char **identity, char **radius_cui);
|
||||
int hostapd_acl_init(struct hostapd_data *hapd);
|
||||
void hostapd_acl_deinit(struct hostapd_data *hapd);
|
||||
void hostapd_free_psk_list(struct hostapd_sta_wpa_psk_short *psk);
|
||||
|
||||
#endif /* IEEE802_11_AUTH_H */
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "accounting.h"
|
||||
#include "ieee802_1x.h"
|
||||
#include "ieee802_11.h"
|
||||
#include "ieee802_11_auth.h"
|
||||
#include "wpa_auth.h"
|
||||
#include "preauth_auth.h"
|
||||
#include "ap_config.h"
|
||||
|
@ -235,11 +236,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
|
|||
wpabuf_free(sta->hs20_ie);
|
||||
|
||||
os_free(sta->ht_capabilities);
|
||||
while (sta->psk) {
|
||||
struct hostapd_sta_wpa_psk_short *prev = sta->psk;
|
||||
sta->psk = sta->psk->next;
|
||||
os_free(prev);
|
||||
}
|
||||
hostapd_free_psk_list(sta->psk);
|
||||
os_free(sta->identity);
|
||||
os_free(sta->radius_cui);
|
||||
|
||||
|
|
Loading…
Reference in a new issue