diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 3d174e4d73..221af39f91 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -1824,11 +1824,19 @@ clear_current_lookup(void) { return; } + if (lookup->cleared) { + debug("current_lookup is already cleared"); + return; + } + if (ISC_LIST_HEAD(lookup->q) != NULL) { debug("still have a worker"); return; } + lookup->cleared = true; + debug("lookup cleared"); + lookup_detach(&lookup); } diff --git a/bin/dig/dighost.h b/bin/dig/dighost.h index e9da8f618e..00158ac6f9 100644 --- a/bin/dig/dighost.h +++ b/bin/dig/dighost.h @@ -105,7 +105,7 @@ typedef struct dig_searchlist dig_searchlist_t; struct dig_lookup { unsigned int magic; isc_refcount_t references; - bool aaonly, adflag, badcookie, besteffort, cdflag, comments, + bool aaonly, adflag, badcookie, besteffort, cdflag, cleared, comments, dns64prefix, dnssec, doing_xfr, done_as_is, ednsneg, expandaaaa, expire, header_only, identify, /*%< Append an "on server " message */