diff options
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_aspath.c | 7 | ||||
-rw-r--r-- | bgpd/bgp_attr.c | 17 |
2 files changed, 13 insertions, 11 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 192cd6ca8..dd27c9f6a 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -328,7 +328,12 @@ void aspath_free(struct aspath *aspath) void aspath_unintern(struct aspath **aspath) { struct aspath *ret; - struct aspath *asp = *aspath; + struct aspath *asp; + + if (!*aspath) + return; + + asp = *aspath; if (asp->refcnt) asp->refcnt--; diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 3c3fd174f..607e5152b 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1093,8 +1093,7 @@ void bgp_attr_unintern_sub(struct attr *attr) struct cluster_list *cluster; /* aspath refcount shoud be decrement. */ - if (attr->aspath) - aspath_unintern(&attr->aspath); + aspath_unintern(&attr->aspath); UNSET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH)); if (attr->community) @@ -3534,14 +3533,12 @@ done: * we can chuck as4_aggregator and as4_path alltogether in order * to save memory */ - if (as4_path) { - /* - * unintern - it is in the hash - * The flag that we got this is still there, but that - * does not do any trouble - */ - aspath_unintern(&as4_path); - } + /* + * unintern - it is in the hash + * The flag that we got this is still there, but that + * does not do any trouble + */ + aspath_unintern(&as4_path); transit = bgp_attr_get_transit(attr); if (ret != BGP_ATTR_PARSE_ERROR) { |