From: John Crispin Date: Wed, 25 Jun 2014 03:06:54 +0000 (+0100) Subject: fix entry duplication bug X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmdnsd.git;a=commitdiff_plain;h=902e2d1eaaff0d3d33dee605a4746fd5d4b6b999;ds=inline fix entry duplication bug Signed-off-by: John Crispin --- 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,