aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/pmksa_cache.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2006-03-25 19:55:18 (GMT)
committerJouni Malinen <j@w1.fi>2006-03-25 19:55:18 (GMT)
commit5914c67e1a34c26a88959bef9919eb742130083f (patch)
tree6a5ac8574d121203e391289b05e5ed1a0eab0b60 /hostapd/pmksa_cache.c
parentf3fdfb82a3d43629aeacf136dea3d3b5feadaba9 (diff)
downloadhostap-history-5914c67e1a34c26a88959bef9919eb742130083f.zip
hostap-history-5914c67e1a34c26a88959bef9919eb742130083f.tar.gz
hostap-history-5914c67e1a34c26a88959bef9919eb742130083f.tar.bz2
Replaced "p = malloc(len); memset(p, 0, len);" constructions with a
new function, wpa_zalloc(). This cleans up the code a bit and makes it less error-prone. In addition, the binary size of the default build on x86 was reduced by about 1 kB (both wpa_supplicant and hostapd).
Diffstat (limited to 'hostapd/pmksa_cache.c')
-rw-r--r--hostapd/pmksa_cache.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hostapd/pmksa_cache.c b/hostapd/pmksa_cache.c
index ade88be..54c2d1d 100644
--- a/hostapd/pmksa_cache.c
+++ b/hostapd/pmksa_cache.c
@@ -228,10 +228,9 @@ pmksa_cache_add(struct rsn_pmksa_cache *pmksa, const u8 *pmk, size_t pmk_len,
if (pmk_len > PMK_LEN)
return NULL;
- entry = malloc(sizeof(*entry));
+ entry = wpa_zalloc(sizeof(*entry));
if (entry == NULL)
return NULL;
- memset(entry, 0, sizeof(*entry));
memcpy(entry->pmk, pmk, pmk_len);
entry->pmk_len = pmk_len;
rsn_pmkid(pmk, pmk_len, aa, spa, entry->pmkid);
@@ -351,9 +350,8 @@ pmksa_cache_init(void (*free_cb)(struct rsn_pmksa_cache_entry *entry,
{
struct rsn_pmksa_cache *pmksa;
- pmksa = malloc(sizeof(*pmksa));
+ pmksa = wpa_zalloc(sizeof(*pmksa));
if (pmksa) {
- memset(pmksa, 0, sizeof(*pmksa));
pmksa->free_cb = free_cb;
pmksa->ctx = ctx;
}