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>
This commit is contained in:
parent
e3b473eb4e
commit
6bf731e8ce
6 changed files with 42 additions and 49 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue