diff options
author | Nigel Kukard <nkukard@lbsd.net> | 2017-08-30 09:37:19 +0200 |
---|---|---|
committer | Nigel Kukard <nkukard@lbsd.net> | 2017-09-01 01:39:53 +0200 |
commit | 4265a53eba952d1108b58327558ad59d023ab186 (patch) | |
tree | 7f2d93a07b2210e62ec874b82da683394f39689f /bgpd/bgp_routemap.c | |
parent | bgpd: Fixed potential memory leak if additive is false in normal communities (diff) | |
download | frr-4265a53eba952d1108b58327558ad59d023ab186.tar.xz frr-4265a53eba952d1108b58327558ad59d023ab186.zip |
bgpd: Fixed potential memory leak if additive is false
The else portion of the IF dups the lc, but doesn't free old
Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_routemap.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index f5ee4fe89..f76110b7e 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -1611,18 +1611,19 @@ static route_map_result_t route_set_lcommunity(void *rule, merge = lcommunity_merge(lcommunity_dup(old), rcs->lcom); - /* HACK: if the old large-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) - lcommunity_free(&old); new = lcommunity_uniq_sort(merge); lcommunity_free(&merge); } else new = lcommunity_dup(rcs->lcom); + /* HACK: if the old large-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 && old->refcnt == 0) + lcommunity_free(&old); + /* will be intern()'d or attr_flush()'d by bgp_update_main() */ attr->lcommunity = new; |