From 1478293fd95f29f16887c5e6554035cd38d4b2d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Mon, 20 Mar 2017 17:55:50 +0100 Subject: [PATCH] Fix code freeing cached non-A(AAA) records too early MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: f89986b67dd5 ("Fix refreshing cached A(AAA) records that expire") Signed-off-by: Rafał Miłecki --- cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cache.c b/cache.c index 6ff2479..0658e7e 100644 --- a/cache.c +++ b/cache.c @@ -80,7 +80,8 @@ cache_gc_timer(struct uloop_timeout *timeout) continue; /* Records other than A(AAA) are handled as services */ if (r->type != TYPE_A && r->type != TYPE_AAAA) { - cache_record_free(r); + if (cache_is_expired(r->time, r->ttl, 100)) + cache_record_free(r); continue; } if (r->refresh >= 100) { -- 2.25.1