summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2012-12-07 14:26:09 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2013-01-14 16:09:19 +0100
commitb06b35f0754747f9f178be155a2903b360aa2b6c (patch)
treea92d70e724c5b5133ecebf9c4d4444bde3870cc2
parent9499bf2bc6daf0a9b7170d3cf994daef2f1a8920 (diff)
bgpd: fix a memleak on "set community none"
Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_routemap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index f2204003..40f20765 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;
}