AP: Simplify "i" definition in hostapd_config_free_bss()

Declare the variable only once and reuse it instead of openning
unneeded scopes.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
This commit is contained in:
Andrei Otcheretianski 2019-06-19 15:49:14 +03:00 committed by Jouni Malinen
parent 30bbff142d
commit a00ace9fd7

View file

@ -593,6 +593,10 @@ static void hostapd_dpp_controller_conf_free(struct dpp_controller_conf *conf)
void hostapd_config_free_bss(struct hostapd_bss_config *conf) void hostapd_config_free_bss(struct hostapd_bss_config *conf)
{ {
#if defined(CONFIG_WPS) || defined(CONFIG_HS20)
size_t i;
#endif
if (conf == NULL) if (conf == NULL)
return; return;
@ -685,12 +689,8 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
os_free(conf->model_description); os_free(conf->model_description);
os_free(conf->model_url); os_free(conf->model_url);
os_free(conf->upc); os_free(conf->upc);
{ for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
unsigned int i; wpabuf_free(conf->wps_vendor_ext[i]);
for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; i++)
wpabuf_free(conf->wps_vendor_ext[i]);
}
wpabuf_free(conf->wps_nfc_dh_pubkey); wpabuf_free(conf->wps_nfc_dh_pubkey);
wpabuf_free(conf->wps_nfc_dh_privkey); wpabuf_free(conf->wps_nfc_dh_privkey);
wpabuf_free(conf->wps_nfc_dev_pw); wpabuf_free(conf->wps_nfc_dev_pw);
@ -716,7 +716,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
os_free(conf->hs20_operating_class); os_free(conf->hs20_operating_class);
os_free(conf->hs20_icons); os_free(conf->hs20_icons);
if (conf->hs20_osu_providers) { if (conf->hs20_osu_providers) {
size_t i;
for (i = 0; i < conf->hs20_osu_providers_count; i++) { for (i = 0; i < conf->hs20_osu_providers_count; i++) {
struct hs20_osu_provider *p; struct hs20_osu_provider *p;
size_t j; size_t j;
@ -734,8 +733,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
os_free(conf->hs20_osu_providers); os_free(conf->hs20_osu_providers);
} }
if (conf->hs20_operator_icon) { if (conf->hs20_operator_icon) {
size_t i;
for (i = 0; i < conf->hs20_operator_icon_count; i++) for (i = 0; i < conf->hs20_operator_icon_count; i++)
os_free(conf->hs20_operator_icon[i]); os_free(conf->hs20_operator_icon[i]);
os_free(conf->hs20_operator_icon); os_free(conf->hs20_operator_icon);