]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pimd: Use XCALLOC instead of XMALLOC
authorDonald Sharp <sharpd@cumulusnetwroks.com>
Sat, 16 Jul 2016 06:45:33 +0000 (02:45 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Dec 2016 01:26:02 +0000 (20:26 -0500)
Ensure that all data structures start out
as 0 filled.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pimd/pim_iface.c
pimd/pim_igmp.c
pimd/pim_igmpv3.c
pimd/pim_neighbor.c
pimd/pim_ssmpingd.c
pimd/pim_upstream.c

index 65b51d2b567012ad88f842ab02248d87ca68905f..584aebb1d49f0d31e45714012a9eb140e660f4ea 100644 (file)
@@ -80,9 +80,9 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim)
   zassert(ifp);
   zassert(!ifp->info);
 
-  pim_ifp = XMALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
+  pim_ifp = XCALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
   if (!pim_ifp) {
-    zlog_err("PIM XMALLOC(%zu) failure", sizeof(*pim_ifp));
+    zlog_err("PIM XCALLOC(%zu) failure", sizeof(*pim_ifp));
     return 0;
   }
 
@@ -997,13 +997,13 @@ static struct igmp_join *igmp_join_new(struct interface *ifp,
     return 0;
   }
 
-  ij = XMALLOC(MTYPE_PIM_IGMP_JOIN, sizeof(*ij));
+  ij = XCALLOC(MTYPE_PIM_IGMP_JOIN, sizeof(*ij));
   if (!ij) {
     char group_str[100];
     char source_str[100];
     pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
     pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
-    zlog_err("%s: XMALLOC(%zu) failure for IGMP group %s source %s on interface %s",
+    zlog_err("%s: XCALLOC(%zu) failure for IGMP group %s source %s on interface %s",
             __PRETTY_FUNCTION__,
             sizeof(*ij), group_str, source_str, ifp->name);
     close(join_fd);
index 189f40ff51a2efdd56a4b207b8b66e979e21a8d9..0f141d4fc62826993dd128434c37bd0946688536 100644 (file)
@@ -1184,9 +1184,9 @@ static struct igmp_sock *igmp_sock_new(int fd,
               fd, inet_ntoa(ifaddr), ifp->name);
   }
 
-  igmp = XMALLOC(MTYPE_PIM_IGMP_SOCKET, sizeof(*igmp));
+  igmp = XCALLOC(MTYPE_PIM_IGMP_SOCKET, sizeof(*igmp));
   if (!igmp) {
-    zlog_warn("%s %s: XMALLOC() failure",
+    zlog_warn("%s %s: XCALLOC() failure",
               __FILE__, __PRETTY_FUNCTION__);
     return 0;
   }
@@ -1392,9 +1392,9 @@ struct igmp_group *igmp_add_group_by_addr(struct igmp_sock *igmp,
     of INCLUDE and an empty source list.
   */
 
-  group = XMALLOC(MTYPE_PIM_IGMP_GROUP, sizeof(*group));
+  group = XCALLOC(MTYPE_PIM_IGMP_GROUP, sizeof(*group));
   if (!group) {
-    zlog_warn("%s %s: XMALLOC() failure",
+    zlog_warn("%s %s: XCALLOC() failure",
              __FILE__, __PRETTY_FUNCTION__);
     return 0; /* error, not found, could not create */
   }
index 05d2699ff7d424adb3938401025c532b64dcade3..2738a9ca5cc4590ed471baa0d884146c76269a75 100644 (file)
@@ -495,9 +495,9 @@ source_new (struct igmp_group *group,
               group->group_igmp_sock->interface->name);
   }
 
-  src = XMALLOC(MTYPE_PIM_IGMP_GROUP_SOURCE, sizeof(*src));
+  src = XCALLOC(MTYPE_PIM_IGMP_GROUP_SOURCE, sizeof(*src));
   if (!src) {
-    zlog_warn("%s %s: XMALLOC() failure",
+    zlog_warn("%s %s: XCALLOC() failure",
              __FILE__, __PRETTY_FUNCTION__);
     return 0; /* error, not found, could not create */
   }
index 90fdc35473fc6256545565905ca4c2c1a1fdbf73..749390595a1c50d544e5b4c3f87eb549dd9eb69b 100644 (file)
@@ -298,9 +298,9 @@ static struct pim_neighbor *pim_neighbor_new(struct interface *ifp,
   pim_ifp = ifp->info;
   zassert(pim_ifp);
 
-  neigh = XMALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
+  neigh = XCALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
   if (!neigh) {
-    zlog_err("%s: PIM XMALLOC(%zu) failure",
+    zlog_err("%s: PIM XCALLOC(%zu) failure",
             __PRETTY_FUNCTION__, sizeof(*neigh));
     return 0;
   }
index 3f494d112df92d8b1f56822efdccb739fb4560d4..0bab8b6586e42b65e69950d3d2fa3dcb0de760d5 100644 (file)
@@ -364,11 +364,11 @@ static struct ssmpingd_sock *ssmpingd_new(struct in_addr source_addr)
     return 0;
   }
 
-  ss = XMALLOC(MTYPE_PIM_SSMPINGD, sizeof(*ss));
+  ss = XCALLOC(MTYPE_PIM_SSMPINGD, sizeof(*ss));
   if (!ss) {
     char source_str[100];
     pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
-    zlog_err("%s: XMALLOC(%zu) failure for ssmpingd source %s",
+    zlog_err("%s: XCALLOC(%zu) failure for ssmpingd source %s",
             __PRETTY_FUNCTION__,
             sizeof(*ss), source_str);
     close(sock_fd);
index 4f2c2d0eaa7c72188151a7b39e5778be5ea640e9..3b533d27fe34865d5c0a816a2ebaea3f259f2514 100644 (file)
@@ -367,9 +367,9 @@ static struct pim_upstream *pim_upstream_new(struct in_addr source_addr,
   struct pim_upstream *up;
   enum pim_rpf_result rpf_result;
 
-  up = XMALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
+  up = XCALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
   if (!up) {
-    zlog_err("%s: PIM XMALLOC(%zu) failure",
+    zlog_err("%s: PIM XCALLOC(%zu) failure",
             __PRETTY_FUNCTION__, sizeof(*up));
     return NULL;
   }