convert MALLOC/FREE to malloc/free

This commit is contained in:
Sam Leffler 2008-12-18 23:00:09 +00:00
parent 9678919ba4
commit e2126dec84
14 changed files with 51 additions and 51 deletions

View File

@ -99,7 +99,7 @@ acl_attach(struct ieee80211vap *vap)
{
struct aclstate *as;
MALLOC(as, struct aclstate *, sizeof(struct aclstate),
as = (struct aclstate *) malloc(sizeof(struct aclstate),
M_80211_ACL, M_NOWAIT | M_ZERO);
if (as == NULL)
return 0;
@ -123,7 +123,7 @@ acl_detach(struct ieee80211vap *vap)
acl_free_all(vap);
vap->iv_as = NULL;
ACL_LOCK_DESTROY(as);
FREE(as, M_80211_ACL);
free(as, M_80211_ACL);
}
static __inline struct acl *
@ -147,7 +147,7 @@ _acl_free(struct aclstate *as, struct acl *acl)
TAILQ_REMOVE(&as->as_list, acl, acl_list);
LIST_REMOVE(acl, acl_hash);
FREE(acl, M_80211_ACL);
free(acl, M_80211_ACL);
as->as_nacls--;
}
@ -175,7 +175,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
struct acl *acl, *new;
int hash;
MALLOC(new, struct acl *, sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO);
new = (struct acl *) malloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO);
if (new == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
"ACL: add %s failed, no memory\n", ether_sprintf(mac));
@ -188,7 +188,7 @@ acl_add(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN])
LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) {
if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) {
ACL_UNLOCK(as);
FREE(new, M_80211_ACL);
free(new, M_80211_ACL);
IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL,
"ACL: add %s failed, already present\n",
ether_sprintf(mac));
@ -301,7 +301,7 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
ireq->i_len = space; /* return required space */
return 0; /* NB: must not error */
}
MALLOC(ap, struct ieee80211req_maclist *, space,
ap = (struct ieee80211req_maclist *) malloc(space,
M_TEMP, M_NOWAIT);
if (ap == NULL)
return ENOMEM;
@ -317,7 +317,7 @@ acl_getioctl(struct ieee80211vap *vap, struct ieee80211req *ireq)
ireq->i_len = space;
} else
error = copyout(ap, ireq->i_data, ireq->i_len);
FREE(ap, M_TEMP);
free(ap, M_TEMP);
return error;
}
return EINVAL;

View File

@ -96,7 +96,7 @@ ccmp_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{
struct ccmp_ctx *ctx;
MALLOC(ctx, struct ccmp_ctx *, sizeof(struct ccmp_ctx),
ctx = (struct ccmp_ctx *) malloc(sizeof(struct ccmp_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++;
@ -113,7 +113,7 @@ ccmp_detach(struct ieee80211_key *k)
{
struct ccmp_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO);
free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}

View File

@ -109,7 +109,7 @@ tkip_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{
struct tkip_ctx *ctx;
MALLOC(ctx, struct tkip_ctx *, sizeof(struct tkip_ctx),
ctx = (struct tkip_ctx *) malloc(sizeof(struct tkip_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++;
@ -126,7 +126,7 @@ tkip_detach(struct ieee80211_key *k)
{
struct tkip_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO);
free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}

View File

@ -87,7 +87,7 @@ wep_attach(struct ieee80211vap *vap, struct ieee80211_key *k)
{
struct wep_ctx *ctx;
MALLOC(ctx, struct wep_ctx *, sizeof(struct wep_ctx),
ctx = (struct wep_ctx *) malloc(sizeof(struct wep_ctx),
M_80211_CRYPTO, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
vap->iv_stats.is_crypto_nomem++;
@ -106,7 +106,7 @@ wep_detach(struct ieee80211_key *k)
{
struct wep_ctx *ctx = k->wk_private;
FREE(ctx, M_80211_CRYPTO);
free(ctx, M_80211_CRYPTO);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}

View File

@ -234,7 +234,7 @@ ieee80211_sysctl_vattach(struct ieee80211vap *vap)
struct sysctl_oid *oid;
char num[14]; /* sufficient for 32 bits */
MALLOC(ctx, struct sysctl_ctx_list *, sizeof(struct sysctl_ctx_list),
ctx = (struct sysctl_ctx_list *) malloc(sizeof(struct sysctl_ctx_list),
M_DEVBUF, M_NOWAIT | M_ZERO);
if (ctx == NULL) {
if_printf(ifp, "%s: cannot allocate sysctl context!\n",
@ -310,7 +310,7 @@ ieee80211_sysctl_vdetach(struct ieee80211vap *vap)
if (vap->iv_sysctl != NULL) {
sysctl_ctx_free(vap->iv_sysctl);
FREE(vap->iv_sysctl, M_DEVBUF);
free(vap->iv_sysctl, M_DEVBUF);
vap->iv_sysctl = NULL;
}
}

View File

@ -902,7 +902,7 @@ hostap_auth_open(struct ieee80211_node *ni, struct ieee80211_frame *wh,
* open auth is attempted.
*/
if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE);
free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL;
}
/* XXX hack to workaround calling convention */
@ -1996,7 +1996,7 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0,
return;
/* discard challenge after association */
if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE);
free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL;
}
/* NB: 802.11 spec says to ignore station's privacy bit */

View File

@ -499,7 +499,7 @@ int
ieee80211_alloc_challenge(struct ieee80211_node *ni)
{
if (ni->ni_challenge == NULL)
MALLOC(ni->ni_challenge, uint32_t*, IEEE80211_CHALLENGE_LEN,
ni->ni_challenge = (uint32_t *) malloc(IEEE80211_CHALLENGE_LEN,
M_80211_NODE, M_NOWAIT);
if (ni->ni_challenge == NULL) {
IEEE80211_NOTE(ni->ni_vap,

View File

@ -320,14 +320,14 @@ ieee80211_ioctl_getscanresults(struct ieee80211vap *vap,
space = req.space;
/* XXX M_WAITOK after driver lock released */
MALLOC(p, void *, space, M_TEMP, M_NOWAIT | M_ZERO);
p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO);
if (p == NULL)
return ENOMEM;
req.sr = p;
ieee80211_scan_iterate(vap, get_scan_result, &req);
ireq->i_len = space - req.space;
error = copyout(p, ireq->i_data, ireq->i_len);
FREE(p, M_TEMP);
free(p, M_TEMP);
} else
ireq->i_len = 0;
@ -467,7 +467,7 @@ getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq,
if (req.space > 0) {
space = req.space;
/* XXX M_WAITOK after driver lock released */
MALLOC(p, void *, space, M_TEMP, M_NOWAIT | M_ZERO);
p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO);
if (p == NULL) {
error = ENOMEM;
goto bad;
@ -479,7 +479,7 @@ getstainfo_common(struct ieee80211vap *vap, struct ieee80211req *ireq,
get_sta_info(&req, ni);
ireq->i_len = space - req.space;
error = copyout(p, (uint8_t *) ireq->i_data+off, ireq->i_len);
FREE(p, M_TEMP);
free(p, M_TEMP);
} else
ireq->i_len = 0;
bad:
@ -696,7 +696,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
if (ireq->i_len != sizeof(struct ieee80211_devcaps_req))
return EINVAL;
MALLOC(dc, struct ieee80211_devcaps_req *,
dc = (struct ieee80211_devcaps_req *) malloc(
sizeof(struct ieee80211_devcaps_req), M_TEMP, M_NOWAIT | M_ZERO);
if (dc == NULL)
return ENOMEM;
@ -707,7 +707,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80211com *ic,
ic->ic_getradiocaps(ic, &ci->ic_nchans, ci->ic_chans);
ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans);
error = copyout(dc, ireq->i_data, sizeof(*dc));
FREE(dc, M_TEMP);
free(dc, M_TEMP);
return error;
}
@ -1985,14 +1985,14 @@ ieee80211_ioctl_setregdomain(struct ieee80211vap *vap,
if (ireq->i_len != sizeof(struct ieee80211_regdomain_req))
return EINVAL;
MALLOC(reg, struct ieee80211_regdomain_req *,
reg = (struct ieee80211_regdomain_req *) malloc(
sizeof(struct ieee80211_regdomain_req), M_TEMP, M_NOWAIT);
if (reg == NULL)
return ENOMEM;
error = copyin(ireq->i_data, reg, sizeof(*reg));
if (error == 0)
error = ieee80211_setregdomain(vap, reg);
FREE(reg, M_TEMP);
free(reg, M_TEMP);
return (error == 0 ? ENETRESET : error);
}
@ -2131,7 +2131,7 @@ setappie(struct ieee80211_appie **aie, const struct ieee80211req *ireq)
if (ireq->i_len == 0) { /* delete any existing ie */
if (app != NULL) {
*aie = NULL; /* XXX racey */
FREE(app, M_80211_NODE_IE);
free(app, M_80211_NODE_IE);
}
return 0;
}
@ -2145,20 +2145,20 @@ setappie(struct ieee80211_appie **aie, const struct ieee80211req *ireq)
*
* XXX bad bad bad
*/
MALLOC(napp, struct ieee80211_appie *,
napp = (struct ieee80211_appie *) malloc(
sizeof(struct ieee80211_appie) + ireq->i_len, M_80211_NODE_IE, M_NOWAIT);
if (napp == NULL)
return ENOMEM;
/* XXX holding ic lock */
error = copyin(ireq->i_data, napp->ie_data, ireq->i_len);
if (error) {
FREE(napp, M_80211_NODE_IE);
free(napp, M_80211_NODE_IE);
return error;
}
napp->ie_len = ireq->i_len;
*aie = napp;
if (app != NULL)
FREE(app, M_80211_NODE_IE);
free(app, M_80211_NODE_IE);
return 0;
}

View File

@ -153,7 +153,7 @@ ieee80211_node_latevattach(struct ieee80211vap *vap)
"WARNING: max aid too small, changed to %d\n",
vap->iv_max_aid);
}
MALLOC(vap->iv_aid_bitmap, uint32_t *,
vap->iv_aid_bitmap = (uint32_t *) malloc(
howmany(vap->iv_max_aid, 32) * sizeof(uint32_t),
M_80211_NODE, M_NOWAIT | M_ZERO);
if (vap->iv_aid_bitmap == NULL) {
@ -180,7 +180,7 @@ ieee80211_node_vdetach(struct ieee80211vap *vap)
vap->iv_bss = NULL;
}
if (vap->iv_aid_bitmap != NULL) {
FREE(vap->iv_aid_bitmap, M_80211_NODE);
free(vap->iv_aid_bitmap, M_80211_NODE);
vap->iv_aid_bitmap = NULL;
}
}
@ -789,7 +789,7 @@ node_alloc(struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN])
{
struct ieee80211_node *ni;
MALLOC(ni, struct ieee80211_node *, sizeof(struct ieee80211_node),
ni = (struct ieee80211_node *) malloc(sizeof(struct ieee80211_node),
M_80211_NODE, M_NOWAIT | M_ZERO);
return ni;
}
@ -807,11 +807,11 @@ ieee80211_ies_init(struct ieee80211_ies *ies, const uint8_t *data, int len)
memset(ies, 0, offsetof(struct ieee80211_ies, data));
if (ies->data != NULL && ies->len != len) {
/* data size changed */
FREE(ies->data, M_80211_NODE_IE);
free(ies->data, M_80211_NODE_IE);
ies->data = NULL;
}
if (ies->data == NULL) {
MALLOC(ies->data, uint8_t *, len, M_80211_NODE_IE, M_NOWAIT);
ies->data = (uint8_t *) malloc(len, M_80211_NODE_IE, M_NOWAIT);
if (ies->data == NULL) {
ies->len = 0;
/* NB: pointers have already been zero'd above */
@ -830,7 +830,7 @@ void
ieee80211_ies_cleanup(struct ieee80211_ies *ies)
{
if (ies->data != NULL)
FREE(ies->data, M_80211_NODE_IE);
free(ies->data, M_80211_NODE_IE);
}
/*
@ -912,7 +912,7 @@ node_cleanup(struct ieee80211_node *ni)
ni->ni_associd = 0;
if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE);
free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL;
}
/*
@ -948,7 +948,7 @@ node_free(struct ieee80211_node *ni)
ieee80211_ies_cleanup(&ni->ni_ies);
ieee80211_psq_cleanup(&ni->ni_psq);
IEEE80211_NODE_WDSQ_DESTROY(ni);
FREE(ni, M_80211_NODE);
free(ni, M_80211_NODE);
}
static void
@ -1791,7 +1791,7 @@ ieee80211_node_table_init(struct ieee80211com *ic,
nt->nt_inact_init = inact;
nt->nt_keyixmax = keyixmax;
if (nt->nt_keyixmax > 0) {
MALLOC(nt->nt_keyixmap, struct ieee80211_node **,
nt->nt_keyixmap = (struct ieee80211_node **) malloc(
keyixmax * sizeof(struct ieee80211_node *),
M_80211_NODE, M_NOWAIT | M_ZERO);
if (nt->nt_keyixmap == NULL)
@ -1852,7 +1852,7 @@ ieee80211_node_table_cleanup(struct ieee80211_node_table *nt)
printf("%s: %s[%u] still active\n", __func__,
nt->nt_name, i);
#endif
FREE(nt->nt_keyixmap, M_80211_NODE);
free(nt->nt_keyixmap, M_80211_NODE);
nt->nt_keyixmap = NULL;
}
IEEE80211_NODE_ITERATE_LOCK_DESTROY(nt);

View File

@ -80,7 +80,7 @@ ieee80211_power_latevattach(struct ieee80211vap *vap)
*/
if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
vap->iv_tim_len = howmany(vap->iv_max_aid,8) * sizeof(uint8_t);
MALLOC(vap->iv_tim_bitmap, uint8_t *, vap->iv_tim_len,
vap->iv_tim_bitmap = (uint8_t *) malloc(vap->iv_tim_len,
M_80211_POWER, M_NOWAIT | M_ZERO);
if (vap->iv_tim_bitmap == NULL) {
printf("%s: no memory for TIM bitmap!\n", __func__);
@ -94,7 +94,7 @@ void
ieee80211_power_vdetach(struct ieee80211vap *vap)
{
if (vap->iv_tim_bitmap != NULL) {
FREE(vap->iv_tim_bitmap, M_80211_POWER);
free(vap->iv_tim_bitmap, M_80211_POWER);
vap->iv_tim_bitmap = NULL;
}
}

View File

@ -214,7 +214,7 @@ ieee80211_proto_vdetach(struct ieee80211vap *vap)
{
#define FREEAPPIE(ie) do { \
if (ie != NULL) \
FREE(ie, M_80211_NODE_IE); \
free(ie, M_80211_NODE_IE); \
} while (0)
/*
* Detach operating mode module.

View File

@ -96,7 +96,7 @@ ieee80211_scan_attach(struct ieee80211com *ic)
{
struct scan_state *ss;
MALLOC(ss, struct scan_state *, sizeof(struct scan_state),
ss = (struct scan_state *) malloc(sizeof(struct scan_state),
M_80211_SCAN, M_NOWAIT | M_ZERO);
if (ss == NULL) {
ic->ic_scan = NULL;
@ -122,7 +122,7 @@ ieee80211_scan_detach(struct ieee80211com *ic)
}
ic->ic_flags &= ~IEEE80211_F_SCAN;
ic->ic_scan = NULL;
FREE(SCAN_PRIVATE(ss), M_80211_SCAN);
free(SCAN_PRIVATE(ss), M_80211_SCAN);
}
}

View File

@ -140,7 +140,7 @@ sta_attach(struct ieee80211_scan_state *ss)
{
struct sta_table *st;
MALLOC(st, struct sta_table *, sizeof(struct sta_table),
st = (struct sta_table *) malloc(sizeof(struct sta_table),
M_80211_SCAN, M_NOWAIT | M_ZERO);
if (st == NULL)
return 0;
@ -164,7 +164,7 @@ sta_detach(struct ieee80211_scan_state *ss)
sta_flush_table(st);
mtx_destroy(&st->st_lock);
mtx_destroy(&st->st_scanlock);
FREE(st, M_80211_SCAN);
free(st, M_80211_SCAN);
KASSERT(nrefs > 0, ("imbalanced attach/detach"));
nrefs--; /* NB: we assume caller locking */
}
@ -198,7 +198,7 @@ sta_flush_table(struct sta_table *st)
TAILQ_REMOVE(&st->st_entry, se, se_list);
LIST_REMOVE(se, se_hash);
ieee80211_ies_cleanup(&se->base.se_ies);
FREE(se, M_80211_SCAN);
free(se, M_80211_SCAN);
}
memset(st->st_maxrssi, 0, sizeof(st->st_maxrssi));
}
@ -231,7 +231,7 @@ sta_add(struct ieee80211_scan_state *ss,
LIST_FOREACH(se, &st->st_hash[hash], se_hash)
if (IEEE80211_ADDR_EQ(se->base.se_macaddr, macaddr))
goto found;
MALLOC(se, struct sta_entry *, sizeof(struct sta_entry),
se = (struct sta_entry *) malloc(sizeof(struct sta_entry),
M_80211_SCAN, M_NOWAIT | M_ZERO);
if (se == NULL) {
mtx_unlock(&st->st_lock);
@ -1509,7 +1509,7 @@ adhoc_age(struct ieee80211_scan_state *ss)
TAILQ_REMOVE(&st->st_entry, se, se_list);
LIST_REMOVE(se, se_hash);
ieee80211_ies_cleanup(&se->base.se_ies);
FREE(se, M_80211_SCAN);
free(se, M_80211_SCAN);
}
}
mtx_unlock(&st->st_lock);

View File

@ -1018,7 +1018,7 @@ sta_auth_shared(struct ieee80211_node *ni, struct ieee80211_frame *wh,
switch (seq) {
case IEEE80211_AUTH_SHARED_PASS:
if (ni->ni_challenge != NULL) {
FREE(ni->ni_challenge, M_80211_NODE);
free(ni->ni_challenge, M_80211_NODE);
ni->ni_challenge = NULL;
}
if (status != 0) {