From 4f28b2b59e4a203e84aab230e285665ad1a4360e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 14 Nov 2020 16:29:16 -0500 Subject: [PATCH] bgpd: When showing a lcommunity free alloced memory We are temporarily allocing memory to show lcommunity information. We then immediately drop it. Account for that memory properly. Signed-off-by: Donald Sharp --- bgpd/bgp_route.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 9873057fa2..1be7e4844d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -11206,6 +11206,7 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc, char *str; int first = 0; uint8_t show_flags = 0; + int ret; if (uj) SET_FLAG(show_flags, BGP_SHOW_OPT_JSON); @@ -11233,10 +11234,13 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc, return CMD_WARNING; } - return bgp_show(vty, bgp, afi, safi, + ret = bgp_show(vty, bgp, afi, safi, (exact ? bgp_show_type_lcommunity_exact : bgp_show_type_lcommunity), lcom, show_flags); + + lcommunity_free(&lcom); + return ret; } static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp, -- 2.39.5