From 21e33c958d6258943796a04b9ac29838a7b41283 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 11 Oct 2021 18:29:54 -0300 Subject: [PATCH] bgpd: remove bogus check `bgp` pointer always exists and is used before this function call. Calling `free` in `json` in this context will also cause a use-after-free crash. Signed-off-by: Rafael Zalamena --- bgpd/bgp_route.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f564bbdbc0..17218f1ff7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -13426,16 +13426,6 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table, bgp = peer->bgp; - if (!bgp) { - if (use_json) { - json_object_string_add(json, "alert", "no BGP"); - vty_out(vty, "%s\n", json_object_to_json_string(json)); - json_object_free(json); - } else - vty_out(vty, "%% No bgp\n"); - return; - } - subgrp = peer_subgroup(peer, afi, safi); if (type == bgp_show_adj_route_advertised && subgrp