summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-05-07 16:53:01 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-05-22 20:25:49 +0200
commitb9f1dca10f9a9bf853a9999a117c8cdeec5b7b69 (patch)
treeb6382403ba177cb56f0ca6054db1ce32428fd7f2
parent1a2fd7078f943e2207ee0f1b0dafdcd2d9c81925 (diff)
bgpd: use on stack struct attr_extra in bgp_attr_unintern()
Reduce memory heap fragmentation and pressure on the memory allocator. Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_attr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 97497821..b63ac4c8 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -657,6 +657,7 @@ bgp_attr_unintern (struct attr **pattr)
struct attr *attr = *pattr;
struct attr *ret;
struct attr tmp;
+ struct attr_extra tmp_extra;
/* Decrement attribute reference. */
attr->refcnt--;
@@ -665,7 +666,7 @@ bgp_attr_unintern (struct attr **pattr)
if (attr->extra)
{
- tmp.extra = bgp_attr_extra_new ();
+ tmp.extra = &tmp_extra;
memcpy (tmp.extra, attr->extra, sizeof (struct attr_extra));
}
@@ -680,7 +681,6 @@ bgp_attr_unintern (struct attr **pattr)
}
bgp_attr_unintern_sub (&tmp);
- bgp_attr_extra_free (&tmp);
}
void