diff --git a/nest/neighbor.c b/nest/neighbor.c index d046e981..1a31fb79 100644 --- a/nest/neighbor.c +++ b/nest/neighbor.c @@ -253,9 +253,7 @@ neigh_find(struct proto *p, ip_addr a, struct iface *iface, uint flags) if ((scope < 0) && !(flags & NEF_STICKY)) return NULL; - n = sl_alloc(neigh_slab); - memset(n, 0, sizeof(neighbor)); - + n = sl_allocz(neigh_slab); add_tail(&neigh_hash_table[h], &n->n); add_tail((scope >= 0) ? &iface->neighbors : &sticky_neigh_list, &n->if_n); n->addr = a; diff --git a/nest/rt-attr.c b/nest/rt-attr.c index 28d956bc..25e39488 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -135,7 +135,7 @@ rt_get_source(struct proto *p, u32 id) if (src) return src; - src = sl_alloc(rte_src_slab); + src = sl_allocz(rte_src_slab); src->proto = p; src->private_id = id; src->global_id = idm_alloc(&src_ids); @@ -366,7 +366,7 @@ nexthop_copy(struct nexthop *o) for (; o; o = o->next) { - struct nexthop *n = sl_alloc(nexthop_slab(o)); + struct nexthop *n = sl_allocz(nexthop_slab(o)); n->gw = o->gw; n->iface = o->iface; n->next = NULL; diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index a8814382..8dfca790 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -423,9 +423,7 @@ bfd_add_session(struct bfd_proto *p, ip_addr addr, ip_addr local, struct iface * struct bfd_iface *ifa = bfd_get_iface(p, local, iface); - struct bfd_session *s = sl_alloc(p->session_slab); - bzero(s, sizeof(struct bfd_session)); - + struct bfd_session *s = sl_allocz(p->session_slab); s->addr = addr; s->ifa = ifa; s->loc_id = bfd_get_free_id(p); diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 4710bfba..828bc118 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1603,6 +1603,7 @@ bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id) px->buck_node.next = NULL; px->buck_node.prev = NULL; + px->next = NULL; px->hash = hash; px->path_id = path_id; net_copy(px->net, net); diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index ea7176fd..52c2a0ce 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -2108,9 +2108,7 @@ ospf_hash_get(struct top_graph *f, u32 domain, u32 lsa, u32 rtr, u32 type) if (e) return e; - e = sl_alloc(f->hash_slab); - bzero(e, sizeof(struct top_hash_entry)); - + e = sl_allocz(f->hash_slab); e->color = OUTSPF; e->dist = LSINFINITY; e->lsa.type_raw = type;