From 373de4b5b05837bc5768084fae824d9d68ce3a7c Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Tue, 13 Jul 2021 22:46:40 -0300 Subject: [PATCH] bgpd: fix crash during configuration removal Test the BFD config pointer before trying to free the session as it might not exist. Signed-off-by: Rafael Zalamena --- bgpd/bgp_bfd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c index f6f2f5f6e4..4995f9a1fd 100644 --- a/bgpd/bgp_bfd.c +++ b/bgpd/bgp_bfd.c @@ -326,7 +326,9 @@ static void bgp_peer_remove_bfd(struct peer *p) return; } - bfd_sess_free(&p->bfd_config->session); + if (p->bfd_config) + bfd_sess_free(&p->bfd_config->session); + XFREE(MTYPE_BFD_CONFIG, p->bfd_config); }