Fix memory leak in P2P build without MLME

The ieee80211_sta_free_hw_features() function is now used outside
the MLME code, so better make sure it gets included in the build
to avoid leaking memory.
This commit is contained in:
Jouni Malinen 2010-10-27 11:26:46 +03:00 committed by Jouni Malinen
parent e11f5a2cbc
commit 2f9c6aa665
4 changed files with 19 additions and 25 deletions

View file

@ -3030,23 +3030,6 @@ void ieee80211_sta_rx(struct wpa_supplicant *wpa_s, const u8 *buf, size_t len,
}
void ieee80211_sta_free_hw_features(struct hostapd_hw_modes *hw_features,
size_t num_hw_features)
{
size_t i;
if (hw_features == NULL)
return;
for (i = 0; i < num_hw_features; i++) {
os_free(hw_features[i].channels);
os_free(hw_features[i].rates);
}
os_free(hw_features);
}
int ieee80211_sta_init(struct wpa_supplicant *wpa_s)
{
u16 num_modes, flags;

View file

@ -37,8 +37,6 @@ int ieee80211_sta_associate(struct wpa_supplicant *wpa_s,
struct wpa_driver_associate_params *params);
int ieee80211_sta_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid,
size_t *len);
void ieee80211_sta_free_hw_features(struct hostapd_hw_modes *hw_features,
size_t num_hw_features);
void ieee80211_sta_rx(struct wpa_supplicant *wpa_s, const u8 *buf, size_t len,
struct ieee80211_rx_status *rx_status);
struct wpa_scan_results *
@ -91,12 +89,6 @@ static inline int ieee80211_sta_get_ssid(struct wpa_supplicant *wpa_s,
return -1;
}
static inline void
ieee80211_sta_free_hw_features(struct hostapd_hw_modes *hw_features,
size_t num_hw_features)
{
}
static inline void
ieee80211_sta_rx(struct wpa_supplicant *wpa_s, const u8 *buf, size_t len,
struct ieee80211_rx_status *rx_status)

View file

@ -2511,3 +2511,20 @@ void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s)
wpa_s->conf->changed_parameters = 0;
}
void ieee80211_sta_free_hw_features(struct hostapd_hw_modes *hw_features,
size_t num_hw_features)
{
size_t i;
if (hw_features == NULL)
return;
for (i = 0; i < num_hw_features; i++) {
os_free(hw_features[i].channels);
os_free(hw_features[i].rates);
}
os_free(hw_features);
}

View file

@ -597,6 +597,8 @@ enum wpa_key_mgmt key_mgmt2driver(int key_mgmt);
enum wpa_cipher cipher_suite2driver(int cipher);
void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s);
void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s);
void ieee80211_sta_free_hw_features(struct hostapd_hw_modes *hw_features,
size_t num_hw_features);
/* events.c */
void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);