summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_nexthop.c12
-rw-r--r--bgpd/bgp_routemap.c11
-rw-r--r--ospf6d/ospf6_asbr.c3
-rw-r--r--ospf6d/ospf6_interface.c6
-rw-r--r--ospf6d/ospf6_lsa.c6
-rw-r--r--ospfclient/ospf_apiclient.c3
-rw-r--r--ospfd/ospf_interface.c4
-rw-r--r--ospfd/ospf_lsa.c8
-rw-r--r--ospfd/ospfd.c4
-rw-r--r--ripd/ripd.c16
-rw-r--r--zebra/irdp_interface.c5
11 files changed, 22 insertions, 56 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 67b91398..67a49f7a 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -571,8 +571,7 @@ bgp_connected_add (struct connected *ifc)
}
else
{
- bc = XMALLOC (0, sizeof (struct bgp_connected_ref));
- memset (bc, 0, sizeof (struct bgp_connected_ref));
+ bc = XCALLOC (0, sizeof (struct bgp_connected_ref));
bc->refcnt = 1;
rn->info = bc;
}
@@ -597,8 +596,7 @@ bgp_connected_add (struct connected *ifc)
}
else
{
- bc = XMALLOC (0, sizeof (struct bgp_connected_ref));
- memset (bc, 0, sizeof (struct bgp_connected_ref));
+ bc = XCALLOC (0, sizeof (struct bgp_connected_ref));
bc->refcnt = 1;
rn->info = bc;
}
@@ -744,8 +742,7 @@ zlookup_read (void)
for (i = 0; i < nexthop_num; i++)
{
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = stream_getc (s);
switch (nexthop->type)
{
@@ -854,8 +851,7 @@ zlookup_read_ipv6 (void)
for (i = 0; i < nexthop_num; i++)
{
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = stream_getc (s);
switch (nexthop->type)
{
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 2d4a8630..1ecf4d0a 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -956,8 +956,7 @@ route_set_ip_nexthop_compile (const char *arg)
}
}
- rins = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_ip_nexthop_set));
- memset (rins, 0, sizeof (struct rmap_ip_nexthop_set));
+ rins = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_ip_nexthop_set));
rins->address = address;
rins->peer_address = peer_address;
@@ -1426,9 +1425,7 @@ route_set_community_compile (const char *arg)
return NULL;
}
- rcs = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_com_set));
- memset (rcs, 0, sizeof (struct rmap_com_set));
-
+ rcs = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct rmap_com_set));
rcs->com = com;
rcs->additive = additive;
rcs->none = none;
@@ -1790,9 +1787,7 @@ route_set_aggregator_as_compile (const char *arg)
char as[10];
char address[20];
- aggregator = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct aggregator));
- memset (aggregator, 0, sizeof (struct aggregator));
-
+ aggregator = XCALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (struct aggregator));
sscanf (arg, "%s %s", as, address);
aggregator->as = strtoul (as, NULL, 10);
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 37b912b4..685b147c 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -504,8 +504,7 @@ ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix,
memcpy (&route->prefix, prefix, sizeof (struct prefix));
info = (struct ospf6_external_info *)
- XMALLOC (MTYPE_OSPF6_EXTERNAL_INFO, sizeof (struct ospf6_external_info));
- memset (info, 0, sizeof (struct ospf6_external_info));
+ XCALLOC (MTYPE_OSPF6_EXTERNAL_INFO, sizeof (struct ospf6_external_info));
route->route_option = info;
info->id = ospf6->external_id++;
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index d266f78e..5a79862f 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -96,11 +96,9 @@ ospf6_interface_create (struct interface *ifp)
unsigned int iobuflen;
oi = (struct ospf6_interface *)
- XMALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface));
+ XCALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface));
- if (oi)
- memset (oi, 0, sizeof (struct ospf6_interface));
- else
+ if (!oi)
{
zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp->ifindex);
return (struct ospf6_interface *) NULL;
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 87df7418..e8290b63 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -468,8 +468,7 @@ ospf6_lsa_create (struct ospf6_lsa_header *header)
/* LSA information structure */
/* allocate memory */
lsa = (struct ospf6_lsa *)
- XMALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa));
- memset (lsa, 0, sizeof (struct ospf6_lsa));
+ XCALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa));
lsa->header = (struct ospf6_lsa_header *) new_header;
@@ -498,8 +497,7 @@ ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header)
/* LSA information structure */
/* allocate memory */
lsa = (struct ospf6_lsa *)
- XMALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa));
- memset (lsa, 0, sizeof (struct ospf6_lsa));
+ XCALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa));
lsa->header = (struct ospf6_lsa_header *) new_header;
SET_FLAG (lsa->flag, OSPF6_LSA_HEADERONLY);
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index 64b83123..ed7ca947 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -259,8 +259,7 @@ ospf_apiclient_connect (char *host, int syncport)
close (async_server_sock);
/* Create new client-side instance */
- new = XMALLOC (MTYPE_OSPF_APICLIENT, sizeof (struct ospf_apiclient));
- memset (new, 0, sizeof (struct ospf_apiclient));
+ new = XCALLOC (MTYPE_OSPF_APICLIENT, sizeof (struct ospf_apiclient));
/* Initialize socket descriptors for sync and async channels */
new->fd_sync = fd1;
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 5d4f415f..951c19a8 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -508,13 +508,11 @@ ospf_new_if_params (void)
{
struct ospf_if_params *oip;
- oip = XMALLOC (MTYPE_OSPF_IF_PARAMS, sizeof (struct ospf_if_params));
+ oip = XCALLOC (MTYPE_OSPF_IF_PARAMS, sizeof (struct ospf_if_params));
if (!oip)
return NULL;
- memset (oip, 0, sizeof (struct ospf_if_params));
-
UNSET_IF_PARAM (oip, output_cost_cmd);
UNSET_IF_PARAM (oip, transmit_delay);
UNSET_IF_PARAM (oip, retransmit_interval);
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 7dab0ca0..aaf1f484 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -3632,9 +3632,7 @@ ospf_schedule_lsa_flood_area (struct ospf_area *area, struct ospf_lsa *lsa)
{
struct lsa_action *data;
- data = XMALLOC (MTYPE_OSPF_MESSAGE, sizeof (struct lsa_action));
- memset (data, 0, sizeof (struct lsa_action));
-
+ data = XCALLOC (MTYPE_OSPF_MESSAGE, sizeof (struct lsa_action));
data->action = LSA_ACTION_FLOOD_AREA;
data->area = area;
data->lsa = ospf_lsa_lock (lsa); /* Message / Flood area */
@@ -3647,9 +3645,7 @@ ospf_schedule_lsa_flush_area (struct ospf_area *area, struct ospf_lsa *lsa)
{
struct lsa_action *data;
- data = XMALLOC (MTYPE_OSPF_MESSAGE, sizeof (struct lsa_action));
- memset (data, 0, sizeof (struct lsa_action));
-
+ data = XCALLOC (MTYPE_OSPF_MESSAGE, sizeof (struct lsa_action));
data->action = LSA_ACTION_FLUSH_AREA;
data->area = area;
data->lsa = ospf_lsa_lock (lsa); /* Message / Flush area */
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index c951a29a..afe52368 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -1390,10 +1390,8 @@ ospf_nbr_nbma_new (void)
{
struct ospf_nbr_nbma *nbr_nbma;
- nbr_nbma = XMALLOC (MTYPE_OSPF_NEIGHBOR_STATIC,
+ nbr_nbma = XCALLOC (MTYPE_OSPF_NEIGHBOR_STATIC,
sizeof (struct ospf_nbr_nbma));
- memset (nbr_nbma, 0, sizeof (struct ospf_nbr_nbma));
-
nbr_nbma->priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
nbr_nbma->v_poll = OSPF_POLL_INTERVAL_DEFAULT;
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 7a0096f0..66a9e49c 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -110,13 +110,9 @@ rip_route_rte (struct rip_info *rinfo)
}
static struct rip_info *
-rip_info_new ()
+rip_info_new (void)
{
- struct rip_info *new;
-
- new = XMALLOC (MTYPE_RIP_INFO, sizeof (struct rip_info));
- memset (new, 0, sizeof (struct rip_info));
- return new;
+ return XCALLOC (MTYPE_RIP_INFO, sizeof (struct rip_info));
}
void
@@ -2700,8 +2696,7 @@ rip_redistribute_withdraw (int type)
static int
rip_create (void)
{
- rip = XMALLOC (MTYPE_RIP, sizeof (struct rip));
- memset (rip, 0, sizeof (struct rip));
+ rip = XCALLOC (MTYPE_RIP, sizeof (struct rip));
/* Set initial value. */
rip->version_send = RI_RIP_VERSION_2;
@@ -3120,10 +3115,7 @@ struct rip_distance
static struct rip_distance *
rip_distance_new (void)
{
- struct rip_distance *new;
- new = XMALLOC (MTYPE_RIP_DISTANCE, sizeof (struct rip_distance));
- memset (new, 0, sizeof (struct rip_distance));
- return new;
+ return XCALLOC (MTYPE_RIP_DISTANCE, sizeof (struct rip_distance));
}
static void
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index dd773402..b3a838b3 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -175,10 +175,7 @@ if_set_defaults(struct interface *ifp)
struct Adv *Adv_new (void)
{
- struct Adv *new;
- new = XMALLOC (MTYPE_TMP, sizeof (struct Adv));
- memset (new, 0, sizeof (struct Adv));
- return new;
+ return XCALLOC (MTYPE_TMP, sizeof (struct Adv));
}
static void