bgscan_learn: Avoid redundant frequencies

Some hw modes (e.g., 11b and 11g) contain the same frequencies,
causing the supp_freqs array to be populated with redundant entries.

Check for the existence of the freq before adding it.

Signed-hostap: Eliad Peller <eliad@wizery.com>
This commit is contained in:
Eliad Peller 2013-12-19 12:03:24 +02:00 committed by Jouni Malinen
parent 3727123269
commit 7dab119380

View File

@ -363,6 +363,9 @@ static int * bgscan_learn_get_supp_freqs(struct wpa_supplicant *wpa_s)
for (j = 0; j < modes[i].num_channels; j++) {
if (modes[i].channels[j].flag & HOSTAPD_CHAN_DISABLED)
continue;
/* some hw modes (e.g. 11b & 11g) contain same freqs */
if (in_array(freqs, modes[i].channels[j].freq))
continue;
n = os_realloc_array(freqs, count + 2, sizeof(int));
if (n == NULL)
continue;