]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Don't leak the ecommunity_ecom2str string in debug
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 19 Mar 2018 02:12:45 +0000 (22:12 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 19 Mar 2018 13:18:10 +0000 (09:18 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_mplsvpn.c

index d87f78a7830dae257675914d0a04229031de40ab..3096afc4c8ed7af9701d17b92e632af548527181 100644 (file)
@@ -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 */