static void transit_unintern(struct transit **transit)
{
+ if (!*transit)
+ return;
+
if ((*transit)->refcnt)
(*transit)->refcnt--;
struct cluster_list *cluster;
struct lcommunity *lcomm = NULL;
struct community *comm = NULL;
+ struct transit *transit;
/* aspath refcount shoud be decrement. */
aspath_unintern(&attr->aspath);
cluster_unintern(&cluster);
bgp_attr_set_cluster(attr, NULL);
- struct transit *transit = bgp_attr_get_transit(attr);
-
- if (transit) {
- transit_unintern(&transit);
- bgp_attr_set_transit(attr, transit);
- }
+ transit = bgp_attr_get_transit(attr);
+ transit_unintern(&transit);
+ bgp_attr_set_transit(attr, NULL);
if (attr->encap_subtlvs)
encap_unintern(&attr->encap_subtlvs, ENCAP_SUBTLV_TYPE);