From: Donald Sharp Date: Mon, 19 Mar 2018 02:12:45 +0000 (-0400) Subject: bgpd: Don't leak the ecommunity_ecom2str string in debug X-Git-Tag: frr-5.0-dev~142^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F1924%2Fhead;p=mirror%2Ffrr.git bgpd: Don't leak the ecommunity_ecom2str string in debug Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index d87f78a783..3096afc4c8 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -627,14 +627,12 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn, /* to */ &static_attr); /* hashed refcounted everything */ bgp_attr_flush(&static_attr); /* free locally-allocated parts */ - if (debug) { - const char *s = ""; + if (debug && new_attr->ecommunity) { + char *s = ecommunity_ecom2str(new_attr->ecommunity, + ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - if (new_attr->ecommunity) { - s = ecommunity_ecom2str(new_attr->ecommunity, - ECOMMUNITY_FORMAT_ROUTE_MAP, 0); - } zlog_debug("%s: new_attr->ecommunity{%s}", __func__, s); + XFREE(MTYPE_ECOMMUNITY_STR, s); } /* Now new_attr is an allocated interned attr */