Use os_* wrapper more consistently

os_free() needs to be used when freeing memory that was allocated with
os_malloc()/os_zalloc()/os_calloc().

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-06-23 20:04:14 +03:00
parent 91b7a5e146
commit f6df3f3a00
2 changed files with 7 additions and 8 deletions

View file

@ -1682,8 +1682,7 @@ bad:
l2_packet_deinit(drv->sock_xmit);
if (drv->ioctl_sock >= 0)
close(drv->ioctl_sock);
if (drv != NULL)
free(drv);
os_free(drv);
return NULL;
}
@ -1711,7 +1710,7 @@ atheros_deinit(void *priv)
l2_packet_deinit(drv->sock_xmit);
if (drv->sock_raw)
l2_packet_deinit(drv->sock_raw);
free(drv);
os_free(drv);
}
static int

View file

@ -322,7 +322,7 @@ static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data,
"failed: %d (%s)",
(unsigned long) len, errno, strerror(errno));
}
free(hdr);
os_free(hdr);
return res;
}
@ -471,18 +471,18 @@ static int hostap_get_seqnum(const char *ifname, void *priv, const u8 *addr,
param = (struct prism2_hostapd_param *) buf;
param->cmd = PRISM2_GET_ENCRYPTION;
if (addr == NULL)
memset(param->sta_addr, 0xff, ETH_ALEN);
os_memset(param->sta_addr, 0xff, ETH_ALEN);
else
memcpy(param->sta_addr, addr, ETH_ALEN);
os_memcpy(param->sta_addr, addr, ETH_ALEN);
param->u.crypt.idx = idx;
if (hostapd_ioctl(drv, param, blen)) {
printf("Failed to get encryption.\n");
ret = -1;
} else {
memcpy(seq, param->u.crypt.seq, 8);
os_memcpy(seq, param->u.crypt.seq, 8);
}
free(buf);
os_free(buf);
return ret;
}