From: John Crispin Date: Wed, 25 Jun 2014 01:09:02 +0000 (+0100) Subject: fix use after free X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=f83b658d1eece21bc704bde04fc00fcfba88847f;p=project%2Fmdnsd.git fix use after free Signed-off-by: John Crispin --- diff --git a/cache.c b/cache.c index adfc815..150fb26 100644 --- a/cache.c +++ b/cache.c @@ -300,8 +300,8 @@ cache_answer(struct interface *iface, uint8_t *base, int blen, char *name, struc r = cache_record_find(name, a->type, port, dlen, rdata); if (r) { if (!a->ttl) { - cache_record_free(r); DBG(1, "D -> %s %s ttl:%d\n", dns_type_string(r->type), r->record, r->ttl); + cache_record_free(r); } else { r->ttl = a->ttl; DBG(1, "A -> %s %s ttl:%d\n", dns_type_string(r->type), r->record, r->ttl);