aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/sme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-03-07 09:17:23 (GMT)
committerJouni Malinen <j@w1.fi>2017-03-07 11:19:10 (GMT)
commita1f11e34c4d6a10bdfef58cdba0b19e1335e087b (patch)
treef3ff7d078578a4b4a7ccf20058e65f1ddb96c622 /wpa_supplicant/sme.c
parentdbdda355d0add3f7d96e3279321d3a63abfc4b32 (diff)
downloadhostap-a1f11e34c4d6a10bdfef58cdba0b19e1335e087b.zip
hostap-a1f11e34c4d6a10bdfef58cdba0b19e1335e087b.tar.gz
hostap-a1f11e34c4d6a10bdfef58cdba0b19e1335e087b.tar.bz2
Use os_memdup()
This leads to cleaner code overall, and also reduces the size of the hostapd and wpa_supplicant binaries (in hwsim test build on x86_64) by about 2.5 and 3.5KiB respectively. The mechanical conversions all over the code were done with the following spatch: @@ expression SIZE, SRC; expression a; @@ -a = os_malloc(SIZE); +a = os_memdup(SRC, SIZE); <... if (!a) {...} ...> -os_memcpy(a, SRC, SIZE); Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'wpa_supplicant/sme.c')
-rw-r--r--wpa_supplicant/sme.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index c2fc5f9..84d02c3 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -1167,10 +1167,9 @@ int sme_update_ft_ies(struct wpa_supplicant *wpa_s, const u8 *md,
os_memcpy(wpa_s->sme.mobility_domain, md, MOBILITY_DOMAIN_ID_LEN);
wpa_hexdump(MSG_DEBUG, "SME: FT IEs", ies, ies_len);
os_free(wpa_s->sme.ft_ies);
- wpa_s->sme.ft_ies = os_malloc(ies_len);
+ wpa_s->sme.ft_ies = os_memdup(ies, ies_len);
if (wpa_s->sme.ft_ies == NULL)
return -1;
- os_memcpy(wpa_s->sme.ft_ies, ies, ies_len);
wpa_s->sme.ft_ies_len = ies_len;
return 0;
}