From: Christian Franke Date: Fri, 7 Dec 2012 14:26:09 +0000 (+0000) Subject: bgpd: fix a memleak on "set community none" X-Git-Tag: frr-2.0-rc1~1714 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b06b35f0754747f9f178be155a2903b360aa2b6c;p=mirror%2Ffrr.git bgpd: fix a memleak on "set community none" Signed-off-by: Christian Franke Signed-off-by: David Lamparter --- diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index f220400329..40f2076534 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1347,6 +1347,9 @@ route_set_community (void *rule, struct prefix *prefix, { attr->flag &= ~(ATTR_FLAG_BIT (BGP_ATTR_COMMUNITIES)); attr->community = NULL; + /* See the longer comment down below. */ + if (old && old->refcnt == 0) + community_free(old); return RMAP_OKAY; }