From 902e2d1eaaff0d3d33dee605a4746fd5d4b6b999 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 25 Jun 2014 04:06:54 +0100 Subject: [PATCH] fix entry duplication bug Signed-off-by: John Crispin --- cache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cache.c b/cache.c index 357cadd..e775537 100644 --- a/cache.c +++ b/cache.c @@ -126,14 +126,14 @@ cache_scan(void) static struct cache_entry* cache_entry(struct interface *iface, char *entry, int hlen, int ttl) { - struct cache_entry *s; + struct cache_entry *s, *t; char *entry_buf; char *host_buf; char *type; - s = avl_find_element(&entries, entry, s, avl); - if (s) - return s; + avl_for_each_element_safe(&entries, s, avl, t) + if (!strcmp(s->entry, entry)) + return s; s = calloc_a(sizeof(*s), &entry_buf, strlen(entry) + 1, -- 2.11.0