pimd: Fix of using uninitialized Memory
Valgrind is reporting that pimd is using uninitialized
memory for comparisons. This commit addresses
the issues found there.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index e801f4e..ad97879 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -223,6 +223,11 @@
ch->t_ifjoin_prune_pending_timer = 0;
ch->ifjoin_creation = 0;
+ ch->ifassert_my_metric = pim_macro_ch_my_assert_metric_eval(ch);
+ ch->ifassert_winner_metric = pim_macro_ch_my_assert_metric_eval (ch);
+
+ ch->ifassert_winner.s_addr = 0;
+
/* Assert state */
ch->t_ifassert_timer = 0;
reset_ifassert_state(ch);
@@ -236,8 +241,6 @@
else
PIM_IF_FLAG_UNSET_ASSERT_TRACKING_DESIRED(ch->flags);
- ch->ifassert_my_metric = pim_macro_ch_my_assert_metric_eval(ch);
-
/* Attach to list */
listnode_add(pim_ifp->pim_ifchannel_list, ch);