summaryrefslogtreecommitdiffstats
path: root/nest
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-05-08 15:12:14 +0200
committerMartin Mares <mj@ucw.cz>2000-05-08 15:12:14 +0200
commit5d86aefb6c4a8e298ee79dc9cbf7c07196d56b5b (patch)
tree97425938c51a26b984e3a12227e04dc9fe267caf /nest
parent818ff1e2b7b8eb8e707608e76ead94e5c6bd442c (diff)
downloadbird-5d86aefb6c4a8e298ee79dc9cbf7c07196d56b5b.tar
bird-5d86aefb6c4a8e298ee79dc9cbf7c07196d56b5b.zip
Really free attributes.
Diffstat (limited to 'nest')
-rw-r--r--nest/rt-attr.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 75e9435..d2e5ae9 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -239,6 +239,16 @@ ea_list_copy(ea_list *o)
return n;
}
+static inline void
+ea_free(ea_list *o)
+{
+ if (o)
+ {
+ ASSERT(!o->next);
+ mb_free(o);
+ }
+}
+
void
ea_format(eattr *e, byte *buf)
{
@@ -407,8 +417,7 @@ static rta **rta_hash_table;
static void
rta_alloc_hash(void)
{
- rta_hash_table = mb_alloc(rta_pool, sizeof(rta *) * rta_cache_size);
- bzero(rta_hash_table, sizeof(rta *) * rta_cache_size);
+ rta_hash_table = mb_allocz(rta_pool, sizeof(rta *) * rta_cache_size);
if (rta_cache_size < 32768)
rta_cache_limit = rta_cache_size * 2;
else
@@ -518,6 +527,12 @@ rta__free(rta *a)
{
ASSERT(rta_cache_count && (a->aflags & RTAF_CACHED));
rta_cache_count--;
+ *a->pprev = a->next;
+ if (a->next)
+ a->next->pprev = a->pprev;
+ a->aflags = 0; /* Poison the entry */
+ ea_free(a->eattrs);
+ sl_free(rta_slab, a);
}
void