1 From patchwork Mon Sep 13 15:48:11 2010
2 Content-Type: text/plain; charset="utf-8"
4 Content-Transfer-Encoding: 7bit
5 Subject: [quagga-dev,8261] bgpd: fix memory leak when deleting a community
6 Date: Mon, 13 Sep 2010 14:48:11 -0000
7 From: Michael Lambert <lambert@psc.edu>
9 Message-Id: <20100913171959.5276EAAAC32@ebola.psc.edu>
10 To: quagga-dev@lists.quagga.net
13 * bgp_routemap.c: (route_set_community_delete) When deleting a
14 community in a route-map the old community was being orphaned. Like
15 the description of the same code in route_set_community, this is a
19 bgpd/bgp_routemap.c | 7 +++++++
20 1 files changed, 7 insertions(+), 0 deletions(-)
22 --- a/bgpd/bgp_routemap.c
23 +++ b/bgpd/bgp_routemap.c
24 @@ -1487,6 +1487,13 @@ route_set_community_delete (void *rule,
25 new = community_uniq_sort (merge);
26 community_free (merge);
28 + /* HACK: if the old community is not intern'd,
29 + * we should free it here, or all reference to it may be lost.
30 + * Really need to cleanup attribute caching sometime.
32 + if (old->refcnt == 0)
33 + community_free (old);
37 binfo->attr->community = NULL;