From 6c61eba7731145cad280f3afde61225d7b78fdc9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 10 Sep 2023 09:38:56 -0400 Subject: [PATCH] bgpd: bgp_show_route_in_table ensure rm exists The rm exists because it is locked while we are walking it, so this should be safe. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4d4a2a5c35..5189b3643c 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -12146,7 +12146,9 @@ static int bgp_show_route_in_table(struct vty *vty, struct bgp *bgp, rm_p); if (type5_pfxlen == match.prefixlen) { is_exact_pfxlen_match = true; - bgp_dest_unlock_node(rm); + rm = bgp_dest_unlock_node(rm); + + assert(rm); break; } }