diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-09 01:49:31 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2007-10-09 01:49:31 +0000 |
commit | 02a4446bf8d442c99bebb15027bbe36db25a22c4 (patch) | |
tree | 3c18bd40c2718a6b76a618f1a5c96abb20ef51a1 /sys/netinet/ip_ipsp.c | |
parent | 3a7cc7c64a0e66adf8bf690009924a2602bc4458 (diff) |
MALLOC+bzero -> malloc+M_ZERO. Don't forget FREE->free this time.
As with many of the last commits, looked at by chl@ in an earlier
version.
Diffstat (limited to 'sys/netinet/ip_ipsp.c')
-rw-r--r-- | sys/netinet/ip_ipsp.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index 20f62d7b073..8f9b274dbca 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.168 2007/02/14 00:53:48 jsg Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.169 2007/10/09 01:49:30 krw Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -588,16 +588,12 @@ tdb_rehash(void) tdb_hashmask = (tdb_hashmask << 1) | 1; - MALLOC(new_tdbh, struct tdb **, - sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, M_WAITOK); - MALLOC(new_tdbaddr, struct tdb **, - sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, M_WAITOK); - MALLOC(new_srcaddr, struct tdb **, - sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, M_WAITOK); - - bzero(new_tdbh, sizeof(struct tdb *) * (tdb_hashmask + 1)); - bzero(new_tdbaddr, sizeof(struct tdb *) * (tdb_hashmask + 1)); - bzero(new_srcaddr, sizeof(struct tdb *) * (tdb_hashmask + 1)); + new_tdbh = malloc(sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, + M_WAITOK | M_ZERO); + new_tdbaddr = malloc(sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, + M_WAITOK | M_ZERO); + new_srcaddr = malloc(sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, + M_WAITOK | M_ZERO); for (i = 0; i <= old_hashmask; i++) { for (tdbp = tdbh[i]; tdbp != NULL; tdbp = tdbnp) { @@ -625,13 +621,13 @@ tdb_rehash(void) } } - FREE(tdbh, M_TDB); + free(tdbh, M_TDB); tdbh = new_tdbh; - FREE(tdbaddr, M_TDB); + free(tdbaddr, M_TDB); tdbaddr = new_tdbaddr; - FREE(tdbsrc, M_TDB); + free(tdbsrc, M_TDB); tdbsrc = new_srcaddr; } @@ -645,19 +641,12 @@ puttdb(struct tdb *tdbp) int s = spltdb(); if (tdbh == NULL) { - MALLOC(tdbh, struct tdb **, - sizeof(struct tdb *) * (tdb_hashmask + 1), - M_TDB, M_WAITOK); - MALLOC(tdbaddr, struct tdb **, - sizeof(struct tdb *) * (tdb_hashmask + 1), - M_TDB, M_WAITOK); - MALLOC(tdbsrc, struct tdb **, - sizeof(struct tdb *) * (tdb_hashmask + 1), - M_TDB, M_WAITOK); - - bzero(tdbh, sizeof(struct tdb *) * (tdb_hashmask + 1)); - bzero(tdbaddr, sizeof(struct tdb *) * (tdb_hashmask + 1)); - bzero(tdbsrc, sizeof(struct tdb *) * (tdb_hashmask + 1)); + tdbh = malloc(sizeof(struct tdb *) * (tdb_hashmask + 1), M_TDB, + M_WAITOK | M_ZERO); + tdbaddr = malloc(sizeof(struct tdb *) * (tdb_hashmask + 1), + M_TDB, M_WAITOK | M_ZERO); + tdbsrc = malloc(sizeof(struct tdb *) * (tdb_hashmask + 1), + M_TDB, M_WAITOK | M_ZERO); } hashval = tdb_hash(tdbp->tdb_spi, &tdbp->tdb_dst, tdbp->tdb_sproto); @@ -775,8 +764,7 @@ tdb_alloc(void) { struct tdb *tdbp; - MALLOC(tdbp, struct tdb *, sizeof(struct tdb), M_TDB, M_WAITOK); - bzero((caddr_t) tdbp, sizeof(struct tdb)); + tdbp = malloc(sizeof(*tdbp), M_TDB, M_WAITOK | M_ZERO); /* Init Incoming SA-Binding Queues. */ TAILQ_INIT(&tdbp->tdb_inp_out); @@ -879,7 +867,7 @@ tdb_free(struct tdb *tdbp) if ((tdbp->tdb_inext) && (tdbp->tdb_inext->tdb_onext == tdbp)) tdbp->tdb_inext->tdb_onext = NULL; - FREE(tdbp, M_TDB); + free(tdbp, M_TDB); } /* |