aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/bgscan_learn.c
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@googlemail.com>2011-10-23 08:58:54 (GMT)
committerJouni Malinen <j@w1.fi>2011-10-23 14:21:50 (GMT)
commit6bf731e8cea4d9d41665d271b331e096c7c569e9 (patch)
treea9e3dc2807ce9cc2b61b80c5ee366c366d464882 /wpa_supplicant/bgscan_learn.c
parente3b473eb4ebcc545ca922312eba6dcbb79c41bdf (diff)
downloadhostap-6bf731e8cea4d9d41665d271b331e096c7c569e9.zip
hostap-6bf731e8cea4d9d41665d271b331e096c7c569e9.tar.gz
hostap-6bf731e8cea4d9d41665d271b331e096c7c569e9.tar.bz2
wpa_supplicant: Unify hardware feature data
The hardware feature data is required in several different places throughout the code. Previously, the data was acquired and freed on demand, but with this patch wpa_supplicant will keep a single copy around at runtime for everyone to use. Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Diffstat (limited to 'wpa_supplicant/bgscan_learn.c')
-rw-r--r--wpa_supplicant/bgscan_learn.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/wpa_supplicant/bgscan_learn.c b/wpa_supplicant/bgscan_learn.c
index ee79511..5385cce 100644
--- a/wpa_supplicant/bgscan_learn.c
+++ b/wpa_supplicant/bgscan_learn.c
@@ -355,20 +355,19 @@ static int bgscan_learn_get_params(struct bgscan_learn_data *data,
static int * bgscan_learn_get_supp_freqs(struct wpa_supplicant *wpa_s)
{
struct hostapd_hw_modes *modes;
- u16 num_modes, flags;
int i, j, *freqs = NULL, *n;
size_t count = 0;
- modes = wpa_drv_get_hw_feature_data(wpa_s, &num_modes, &flags);
- if (!modes)
+ modes = wpa_s->hw.modes;
+ if (modes == NULL)
return NULL;
- for (i = 0; i < num_modes; i++) {
+ for (i = 0; i < wpa_s->hw.num_modes; i++) {
for (j = 0; j < modes[i].num_channels; j++) {
if (modes[i].channels[j].flag & HOSTAPD_CHAN_DISABLED)
continue;
n = os_realloc(freqs, (count + 2) * sizeof(int));
- if (!n)
+ if (n == NULL)
continue;
freqs = n;
@@ -376,10 +375,7 @@ static int * bgscan_learn_get_supp_freqs(struct wpa_supplicant *wpa_s)
count++;
freqs[count] = 0;
}
- os_free(modes[i].channels);
- os_free(modes[i].rates);
}
- os_free(modes);
return freqs;
}