]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix memory leak when deleting a community
authorMichael Lambert <lambert@psc.edu>
Mon, 13 Sep 2010 15:48:11 +0000 (11:48 -0400)
committerPaul Jakma <paul@quagga.net>
Fri, 1 Apr 2011 14:58:39 +0000 (15:58 +0100)
* bgp_routemap.c: (route_set_community_delete) When deleting a
  community in a route-map the old community was being orphaned.  Like
  the description of the same code in route_set_community, this is a
  hack, not a true fix.

bgpd/bgp_routemap.c

index 81ff48dbd6cb5278568b371a95c6292c4926d4f9..255b25aedfbc827602e5b6429da9a0d2fee5a6f2 100644 (file)
@@ -1393,6 +1393,13 @@ route_set_community_delete (void *rule, struct prefix *prefix,
          new = community_uniq_sort (merge);
          community_free (merge);
 
+         /* HACK: if the old community is not intern'd,
+          * we should free it here, or all reference to it may be lost.
+          * Really need to cleanup attribute caching sometime.
+          */
+         if (old->refcnt == 0)
+           community_free (old);
+
          if (new->size == 0)
            {
              binfo->attr->community = NULL;