diff options
author | Jorge Boncompte [DTI2] <jorge@dti2.net> | 2012-05-07 18:53:00 +0200 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2012-05-22 20:25:49 +0200 |
commit | 1a2fd7078f943e2207ee0f1b0dafdcd2d9c81925 (patch) | |
tree | da0852c5c4019c6c1893dec384e9f20df26cea29 /bgpd | |
parent | bgpd: use on stack struct attr_extra on bgp_attr_aggregate_intern() (diff) | |
download | frr-1a2fd7078f943e2207ee0f1b0dafdcd2d9c81925.tar.xz frr-1a2fd7078f943e2207ee0f1b0dafdcd2d9c81925.zip |
bgpd: cleanup bgp_attr_unintern()
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_attr.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index bb21fe19d..974978210 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -652,30 +652,31 @@ bgp_attr_unintern_sub (struct attr *attr) /* Free bgp attribute and aspath. */ void -bgp_attr_unintern (struct attr **attr) +bgp_attr_unintern (struct attr **pattr) { + struct attr *attr = *pattr; struct attr *ret; struct attr tmp; /* Decrement attribute reference. */ - (*attr)->refcnt--; + attr->refcnt--; - tmp = *(*attr); + tmp = *attr; - if ((*attr)->extra) + if (attr->extra) { tmp.extra = bgp_attr_extra_new (); - memcpy (tmp.extra, (*attr)->extra, sizeof (struct attr_extra)); + memcpy (tmp.extra, attr->extra, sizeof (struct attr_extra)); } /* If reference becomes zero then free attribute object. */ - if ((*attr)->refcnt == 0) - { - ret = hash_release (attrhash, *attr); + if (attr->refcnt == 0) + { + ret = hash_release (attrhash, attr); assert (ret != NULL); - bgp_attr_extra_free (*attr); - XFREE (MTYPE_ATTR, *attr); - *attr = NULL; + bgp_attr_extra_free (attr); + XFREE (MTYPE_ATTR, attr); + *pattr = NULL; } bgp_attr_unintern_sub (&tmp); |