From e4604b71d2b41de4e3bf22f07fdd3d324fdd0a7a Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 2 May 2023 12:24:34 +0000 Subject: [PATCH] dighost.c: don't call check_if_done() twice successively The check_if_done() function can pass control back out to dighost_shutdown() (which is part of dig.c, host.c, or nslookup.c), and calling that twice can cause unexpected problems, if it is not designed to be idempotent. Since cancel_lookup() calls check_if_done() implicitly, don't call check_if_done() again when 'next' is NULL. --- bin/dig/dighost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 55168fa699..d8323c6f66 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -3212,11 +3212,11 @@ udp_ready(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { if (next != NULL) { start_udp(next); + check_if_done(); } else { clear_current_lookup(); } - check_if_done(); return; } @@ -3609,11 +3609,11 @@ tcp_connected(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { if (next != NULL) { start_tcp(next); + check_if_done(); } else { clear_current_lookup(); } - check_if_done(); return; }