bgpd: cleanup bgp_attr_unintern()
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index bb21fe1..9749782 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -652,30 +652,31 @@
/* 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);