]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: remove bogus check
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 11 Oct 2021 21:29:54 +0000 (18:29 -0300)
committermergify-bot <noreply@mergify.io>
Tue, 26 Oct 2021 15:07:52 +0000 (15:07 +0000)
`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 <rzalamena@opensourcerouting.org>
(cherry picked from commit 21e33c958d6258943796a04b9ac29838a7b41283)

bgpd/bgp_route.c

index aafe66aa19c06c5a751d28e5e48607b4747d0d97..8b34b2b8bed2188d367fd17608a351523b3109c8 100644 (file)
@@ -13427,16 +13427,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