mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 07:15:19 +00:00
pimd: Use XCALLOC instead of XMALLOC
Ensure that all data structures start out as 0 filled. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
0e6ae42582
commit
36d9e7dcea
@ -80,9 +80,9 @@ struct pim_interface *pim_if_new(struct interface *ifp, int igmp, int pim)
|
|||||||
zassert(ifp);
|
zassert(ifp);
|
||||||
zassert(!ifp->info);
|
zassert(!ifp->info);
|
||||||
|
|
||||||
pim_ifp = XMALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
|
pim_ifp = XCALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
|
||||||
if (!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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,13 +997,13 @@ static struct igmp_join *igmp_join_new(struct interface *ifp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ij = XMALLOC(MTYPE_PIM_IGMP_JOIN, sizeof(*ij));
|
ij = XCALLOC(MTYPE_PIM_IGMP_JOIN, sizeof(*ij));
|
||||||
if (!ij) {
|
if (!ij) {
|
||||||
char group_str[100];
|
char group_str[100];
|
||||||
char source_str[100];
|
char source_str[100];
|
||||||
pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
|
pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
|
||||||
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_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__,
|
__PRETTY_FUNCTION__,
|
||||||
sizeof(*ij), group_str, source_str, ifp->name);
|
sizeof(*ij), group_str, source_str, ifp->name);
|
||||||
close(join_fd);
|
close(join_fd);
|
||||||
|
@ -1184,9 +1184,9 @@ static struct igmp_sock *igmp_sock_new(int fd,
|
|||||||
fd, inet_ntoa(ifaddr), ifp->name);
|
fd, inet_ntoa(ifaddr), ifp->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
igmp = XMALLOC(MTYPE_PIM_IGMP_SOCKET, sizeof(*igmp));
|
igmp = XCALLOC(MTYPE_PIM_IGMP_SOCKET, sizeof(*igmp));
|
||||||
if (!igmp) {
|
if (!igmp) {
|
||||||
zlog_warn("%s %s: XMALLOC() failure",
|
zlog_warn("%s %s: XCALLOC() failure",
|
||||||
__FILE__, __PRETTY_FUNCTION__);
|
__FILE__, __PRETTY_FUNCTION__);
|
||||||
return 0;
|
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.
|
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) {
|
if (!group) {
|
||||||
zlog_warn("%s %s: XMALLOC() failure",
|
zlog_warn("%s %s: XCALLOC() failure",
|
||||||
__FILE__, __PRETTY_FUNCTION__);
|
__FILE__, __PRETTY_FUNCTION__);
|
||||||
return 0; /* error, not found, could not create */
|
return 0; /* error, not found, could not create */
|
||||||
}
|
}
|
||||||
|
@ -495,9 +495,9 @@ source_new (struct igmp_group *group,
|
|||||||
group->group_igmp_sock->interface->name);
|
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) {
|
if (!src) {
|
||||||
zlog_warn("%s %s: XMALLOC() failure",
|
zlog_warn("%s %s: XCALLOC() failure",
|
||||||
__FILE__, __PRETTY_FUNCTION__);
|
__FILE__, __PRETTY_FUNCTION__);
|
||||||
return 0; /* error, not found, could not create */
|
return 0; /* error, not found, could not create */
|
||||||
}
|
}
|
||||||
|
@ -298,9 +298,9 @@ static struct pim_neighbor *pim_neighbor_new(struct interface *ifp,
|
|||||||
pim_ifp = ifp->info;
|
pim_ifp = ifp->info;
|
||||||
zassert(pim_ifp);
|
zassert(pim_ifp);
|
||||||
|
|
||||||
neigh = XMALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
|
neigh = XCALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
|
||||||
if (!neigh) {
|
if (!neigh) {
|
||||||
zlog_err("%s: PIM XMALLOC(%zu) failure",
|
zlog_err("%s: PIM XCALLOC(%zu) failure",
|
||||||
__PRETTY_FUNCTION__, sizeof(*neigh));
|
__PRETTY_FUNCTION__, sizeof(*neigh));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -364,11 +364,11 @@ static struct ssmpingd_sock *ssmpingd_new(struct in_addr source_addr)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ss = XMALLOC(MTYPE_PIM_SSMPINGD, sizeof(*ss));
|
ss = XCALLOC(MTYPE_PIM_SSMPINGD, sizeof(*ss));
|
||||||
if (!ss) {
|
if (!ss) {
|
||||||
char source_str[100];
|
char source_str[100];
|
||||||
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
|
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__,
|
__PRETTY_FUNCTION__,
|
||||||
sizeof(*ss), source_str);
|
sizeof(*ss), source_str);
|
||||||
close(sock_fd);
|
close(sock_fd);
|
||||||
|
@ -367,9 +367,9 @@ static struct pim_upstream *pim_upstream_new(struct in_addr source_addr,
|
|||||||
struct pim_upstream *up;
|
struct pim_upstream *up;
|
||||||
enum pim_rpf_result rpf_result;
|
enum pim_rpf_result rpf_result;
|
||||||
|
|
||||||
up = XMALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
|
up = XCALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
|
||||||
if (!up) {
|
if (!up) {
|
||||||
zlog_err("%s: PIM XMALLOC(%zu) failure",
|
zlog_err("%s: PIM XCALLOC(%zu) failure",
|
||||||
__PRETTY_FUNCTION__, sizeof(*up));
|
__PRETTY_FUNCTION__, sizeof(*up));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user