aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-12-07 14:51:38 (GMT)
committerJouni Malinen <j@w1.fi>2014-12-08 09:42:07 (GMT)
commitfaebdeaa9ea5aefc7e45c4d52710c5d67cdbc89f (patch)
tree107bd847a065aa15843a8571d809a61281ee61bd
parent33d0b1579be38d81752eb7bc8dd80c94e85f52ec (diff)
downloadhostap-faebdeaa9ea5aefc7e45c4d52710c5d67cdbc89f.zip
hostap-faebdeaa9ea5aefc7e45c4d52710c5d67cdbc89f.tar.gz
hostap-faebdeaa9ea5aefc7e45c4d52710c5d67cdbc89f.tar.bz2
Use os_calloc() instead of os_zalloc()
Automatic changes with spatch using the following semantic patch: @@ constant C; type T; @@ - os_zalloc(C*sizeof(T)) + os_calloc(C,sizeof(T)) @@ expression E; type T; @@ - os_zalloc((E)*sizeof(T)) + os_calloc(E,sizeof(T)) Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/ap/gas_serv.c2
-rw-r--r--src/ap/hostapd.c2
-rw-r--r--src/eap_peer/eap_methods.c2
-rw-r--r--wpa_supplicant/scan.c14
-rw-r--r--wpa_supplicant/wnm_sta.c4
-rw-r--r--wpa_supplicant/wpa_supplicant.c4
6 files changed, 14 insertions, 14 deletions
diff --git a/src/ap/gas_serv.c b/src/ap/gas_serv.c
index e16c107..9d19f98 100644
--- a/src/ap/gas_serv.c
+++ b/src/ap/gas_serv.c
@@ -58,7 +58,7 @@ gas_dialog_create(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token)
}
if (sta->gas_dialog == NULL) {
- sta->gas_dialog = os_zalloc(GAS_DIALOG_MAX *
+ sta->gas_dialog = os_calloc(GAS_DIALOG_MAX,
sizeof(struct gas_dialog_info));
if (sta->gas_dialog == NULL)
return NULL;
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 71a9a2e..5161333 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1878,7 +1878,7 @@ static struct hostapd_iface * hostapd_data_alloc(
hapd_iface->conf = conf;
hapd_iface->num_bss = conf->num_bss;
- hapd_iface->bss = os_zalloc(conf->num_bss *
+ hapd_iface->bss = os_calloc(conf->num_bss,
sizeof(struct hostapd_data *));
if (hapd_iface->bss == NULL)
return NULL;
diff --git a/src/eap_peer/eap_methods.c b/src/eap_peer/eap_methods.c
index 83a1457..4998567 100644
--- a/src/eap_peer/eap_methods.c
+++ b/src/eap_peer/eap_methods.c
@@ -133,7 +133,7 @@ char ** eap_get_names_as_string_array(size_t *num)
for (m = eap_methods; m; m = m->next)
array_len++;
- array = os_zalloc(sizeof(char *) * (array_len + 1));
+ array = os_calloc(array_len + 1, sizeof(char *));
if (array == NULL)
return NULL;
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index eb15d3e..9db85b9 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -294,7 +294,7 @@ wpa_supplicant_build_filter_ssids(struct wpa_config *conf, size_t *num_ssids)
}
if (count == 0)
return NULL;
- ssids = os_zalloc(count * sizeof(struct wpa_driver_scan_filter));
+ ssids = os_calloc(count, sizeof(struct wpa_driver_scan_filter));
if (ssids == NULL)
return NULL;
@@ -322,7 +322,7 @@ static void wpa_supplicant_optimize_freqs(
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO "
"preferred frequency %d MHz",
wpa_s->go_params->freq);
- params->freqs = os_zalloc(2 * sizeof(int));
+ params->freqs = os_calloc(2, sizeof(int));
if (params->freqs)
params->freqs[0] = wpa_s->go_params->freq;
} else if (wpa_s->p2p_in_provisioning < 8 &&
@@ -346,7 +346,7 @@ static void wpa_supplicant_optimize_freqs(
wpa_s->p2p_invite_go_freq > 0) {
wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Scan only GO preferred frequency %d MHz during invitation",
wpa_s->p2p_invite_go_freq);
- params->freqs = os_zalloc(2 * sizeof(int));
+ params->freqs = os_calloc(2, sizeof(int));
if (params->freqs)
params->freqs[0] = wpa_s->p2p_invite_go_freq;
}
@@ -372,7 +372,7 @@ static void wpa_supplicant_optimize_freqs(
*/
wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz "
"that was used during provisioning", wpa_s->wps_freq);
- params->freqs = os_zalloc(2 * sizeof(int));
+ params->freqs = os_calloc(2, sizeof(int));
if (params->freqs)
params->freqs[0] = wpa_s->wps_freq;
wpa_s->after_wps--;
@@ -384,7 +384,7 @@ static void wpa_supplicant_optimize_freqs(
/* Optimize provisioning scan based on already known channel */
wpa_dbg(wpa_s, MSG_DEBUG, "WPS: Scan only frequency %u MHz",
wpa_s->wps_freq);
- params->freqs = os_zalloc(2 * sizeof(int));
+ params->freqs = os_calloc(2, sizeof(int));
if (params->freqs)
params->freqs[0] = wpa_s->wps_freq;
wpa_s->known_wps_freq = 0; /* only do this once */
@@ -533,7 +533,7 @@ static void wpa_setband_scan_freqs_list(struct wpa_supplicant *wpa_s,
return;
}
- params->freqs = os_zalloc((mode->num_channels + 1) * sizeof(int));
+ params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
if (params->freqs == NULL)
return;
for (count = 0, i = 0; i < mode->num_channels; i++) {
@@ -1151,7 +1151,7 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
os_memset(&params, 0, sizeof(params));
/* If we can't allocate space for the filters, we just don't filter */
- params.filter_ssids = os_zalloc(wpa_s->max_match_sets *
+ params.filter_ssids = os_calloc(wpa_s->max_match_sets,
sizeof(struct wpa_driver_scan_filter));
prev_state = wpa_s->wpa_state;
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index 38be02b..954de67 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -854,8 +854,8 @@ static void ieee802_11_rx_bss_trans_mgmt_req(struct wpa_supplicant *wpa_s,
wpa_msg(wpa_s, MSG_INFO, "WNM: Preferred List Available");
wnm_deallocate_memory(wpa_s);
- wpa_s->wnm_neighbor_report_elements = os_zalloc(
- WNM_MAX_NEIGHBOR_REPORT *
+ wpa_s->wnm_neighbor_report_elements = os_calloc(
+ WNM_MAX_NEIGHBOR_REPORT,
sizeof(struct neighbor_report));
if (wpa_s->wnm_neighbor_report_elements == NULL)
return;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 903bd0d..68fcbef 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -4275,7 +4275,7 @@ struct wpa_global * wpa_supplicant_init(struct wpa_params *params)
wpa_supplicant_deinit(global);
return NULL;
}
- global->drv_priv = os_zalloc(global->drv_count * sizeof(void *));
+ global->drv_priv = os_calloc(global->drv_count, sizeof(void *));
if (global->drv_priv == NULL) {
wpa_supplicant_deinit(global);
return NULL;
@@ -4434,7 +4434,7 @@ static int * get_bss_freqs_in_ess(struct wpa_supplicant *wpa_s)
int *freqs;
int num_freqs = 0;
- freqs = os_zalloc(sizeof(int) * (max_freqs + 1));
+ freqs = os_calloc(max_freqs + 1, sizeof(int));
if (freqs == NULL)
return NULL;