summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-12-11 19:28:08 -0500
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-01-30 12:53:27 -0500
commit98573e196c0d15c8f753a13327066a62bde77dcd (patch)
tree929495427d91554a00f86e114a3cd5b62029c97c
parente34a317acf2addc6d864d238ed41f5977403af43 (diff)
pimd: Cleanup uninitialized memory access
Valgrind noticed that we have a read of uninitialized memory: Conditional jump or move depends on uninitialised value(s) ==13749== at 0x428067: pim_ifassert_winner_set (pim_assert.c:57) ==13749== by 0x4266F0: pim_ifchannel_add (pim_ifchannel.c:535) ==13749== by 0x426CC1: pim_ifchannel_join_add (pim_ifchannel.c:730) ==13749== by 0x427B5B: recv_join (pim_join.c:95) ==13749== by 0x427B5B: pim_joinprune_recv (pim_join.c:270) ==13749== by 0x42354F: pim_pim_packet (pim_pim.c:249) ==13749== by 0x4236C0: pim_sock_read (pim_pim.c:349) ==13749== by 0x4E60587: thread_call (thread.c:1462) ==13749== by 0x40C75E: main (pim_main.c:266) ==13749== This commit fixes that issue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--pimd/pim_ifchannel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 7056ade501..0c0c2c4043 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -496,7 +496,7 @@ pim_ifchannel_add(struct interface *ifp,
return NULL;
}
- ch = XMALLOC(MTYPE_PIM_IFCHANNEL, sizeof(*ch));
+ ch = XCALLOC(MTYPE_PIM_IFCHANNEL, sizeof(*ch));
if (!ch) {
zlog_warn("%s: pim_ifchannel_new() failure for (S,G)=%s on interface %s",
__PRETTY_FUNCTION__,
@@ -535,6 +535,7 @@ pim_ifchannel_add(struct interface *ifp,
/* Assert state */
ch->t_ifassert_timer = NULL;
+ ch->ifassert_state = PIM_IFASSERT_NOINFO;
reset_ifassert_state(ch);
if (pim_macro_ch_could_assert_eval(ch))
PIM_IF_FLAG_SET_COULD_ASSERT(ch->flags);