diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-05-11 12:16:44 +0200 |
---|---|---|
committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-05-11 13:08:47 +0200 |
commit | 6006b807b1a84d31611173b837fafcd96ba9d692 (patch) | |
tree | 08f25453328d8c408f1a8c658e4e6ef91005d4a7 /zebra/connected.c | |
parent | ripd: Use correct usage of memcpy() when zeroing struct (diff) | |
download | frr-6006b807b1a84d31611173b837fafcd96ba9d692.tar.xz frr-6006b807b1a84d31611173b837fafcd96ba9d692.zip |
*: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...));
Good: memset(&a, 0, sizeof(a));
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'zebra/connected.c')
-rw-r--r-- | zebra/connected.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zebra/connected.c b/zebra/connected.c index eb2720335..c01be58e8 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -512,14 +512,14 @@ void connected_delete_ipv4(struct interface *ifp, int flags, struct prefix p, d; struct connected *ifc; - memset(&p, 0, sizeof(struct prefix)); + memset(&p, 0, sizeof(p)); p.family = AF_INET; p.u.prefix4 = *addr; p.prefixlen = CHECK_FLAG(flags, ZEBRA_IFA_PEER) ? IPV4_MAX_BITLEN : prefixlen; if (dest) { - memset(&d, 0, sizeof(struct prefix)); + memset(&d, 0, sizeof(d)); d.family = AF_INET; d.u.prefix4 = *dest; d.prefixlen = prefixlen; @@ -603,7 +603,7 @@ void connected_delete_ipv6(struct interface *ifp, struct prefix p, d; struct connected *ifc; - memset(&p, 0, sizeof(struct prefix)); + memset(&p, 0, sizeof(p)); p.family = AF_INET6; memcpy(&p.u.prefix6, address, sizeof(struct in6_addr)); p.prefixlen = prefixlen; @@ -613,7 +613,7 @@ void connected_delete_ipv6(struct interface *ifp, rtadv_delete_prefix(ifp->info, &p); if (dest) { - memset(&d, 0, sizeof(struct prefix)); + memset(&d, 0, sizeof(d)); d.family = AF_INET6; IPV6_ADDR_COPY(&d.u.prefix6, dest); d.prefixlen = prefixlen; |