Declare the variable only once and reuse it instead of openning unneeded scopes. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx> --- src/ap/ap_config.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 48d09bcf9d..5f0f2e0da7 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -593,6 +593,8 @@ static void hostapd_dpp_controller_conf_free(struct dpp_controller_conf *conf) void hostapd_config_free_bss(struct hostapd_bss_config *conf) { + size_t i; + if (conf == NULL) return; @@ -685,12 +687,8 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf) os_free(conf->model_description); os_free(conf->model_url); os_free(conf->upc); - { - unsigned int i; - - for (i = 0; i < MAX_WPS_VENDOR_EXTENSIONS; 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_privkey); wpabuf_free(conf->wps_nfc_dev_pw); @@ -716,7 +714,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf) os_free(conf->hs20_operating_class); os_free(conf->hs20_icons); if (conf->hs20_osu_providers) { - size_t i; for (i = 0; i < conf->hs20_osu_providers_count; i++) { struct hs20_osu_provider *p; size_t j; @@ -734,8 +731,6 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf) os_free(conf->hs20_osu_providers); } if (conf->hs20_operator_icon) { - size_t i; - for (i = 0; i < conf->hs20_operator_icon_count; i++) os_free(conf->hs20_operator_icon[i]); os_free(conf->hs20_operator_icon); -- 2.19.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap