diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-03-07 09:17:23 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2017-03-07 11:19:10 (GMT) |
commit | a1f11e34c4d6a10bdfef58cdba0b19e1335e087b (patch) | |
tree | f3ff7d078578a4b4a7ccf20058e65f1ddb96c622 /wpa_supplicant/hs20_supplicant.c | |
parent | dbdda355d0add3f7d96e3279321d3a63abfc4b32 (diff) | |
download | hostap-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/hs20_supplicant.c')
-rw-r--r-- | wpa_supplicant/hs20_supplicant.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/wpa_supplicant/hs20_supplicant.c b/wpa_supplicant/hs20_supplicant.c index e88f147..cbcbc95 100644 --- a/wpa_supplicant/hs20_supplicant.c +++ b/wpa_supplicant/hs20_supplicant.c @@ -429,10 +429,9 @@ static int hs20_process_icon_binary_file(struct wpa_supplicant *wpa_s, dl_list_for_each(icon, &wpa_s->icon_head, struct icon_entry, list) { if (icon->dialog_token == dialog_token && !icon->image && os_memcmp(icon->bssid, sa, ETH_ALEN) == 0) { - icon->image = os_malloc(slen); + icon->image = os_memdup(pos, slen); if (!icon->image) return -1; - os_memcpy(icon->image, pos, slen); icon->image_len = slen; hs20_remove_duplicate_icons(wpa_s, icon); wpa_msg(wpa_s, MSG_INFO, |