From ed74032b7fba70bde4bfc118690b38e49d057c69 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 16 Mar 2019 21:25:59 -0400 Subject: [PATCH] bfdd: Prevent uninited use of data Running valgrind w/ bfdd and shut/no shuting interfaces can result in this valgrind issue: ==20279== Conditional jump or move depends on uninitialised value(s) ==20279== at 0x115848: bfdd_sessions_enable_address (ptm_adapter.c:644) ==20279== by 0x115848: bfdd_interface_address_update (ptm_adapter.c:674) ==20279== by 0x48D8CAB: zclient_read (zclient.c:2698) ==20279== by 0x48CCEE3: thread_call (thread.c:1603) ==20279== by 0x48A84EF: frr_run (libfrr.c:1011) ==20279== by 0x10DAC3: main (bfdd.c:236) ==20279== When creating the bso data structure set the bso_isaddress to false as a default value. Signed-off-by: Donald Sharp --- bfdd/bfd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 08e8e06580..3575ba7a00 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -1187,7 +1187,8 @@ int bs_observer_add(struct bfd_session *bs) { struct bfd_session_observer *bso; - bso = XMALLOC(MTYPE_BFDD_SESSION_OBSERVER, sizeof(*bso)); + bso = XCALLOC(MTYPE_BFDD_SESSION_OBSERVER, sizeof(*bso)); + bso->bso_isaddress = false; bso->bso_bs = bs; bso->bso_isinterface = !BFD_CHECK_FLAG(bs->flags, BFD_SESS_FLAG_MH); if (bso->bso_isinterface) -- 2.39.5