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 <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2021-07-13 22:46:40 -03:00
parent a95ba7a7c8
commit 373de4b5b0

View File

@ -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);
}