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 <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2020-11-14 16:29:16 -05:00
parent 15675d025d
commit 4f28b2b59e

View File

@ -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,