]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dighost.c: don't call check_if_done() twice successively
authorAram Sargsyan <aram@isc.org>
Tue, 2 May 2023 12:24:34 +0000 (12:24 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Wed, 10 May 2023 11:35:51 +0000 (11:35 +0000)
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

index 55168fa69910be7b31819993f37eae4b11b26fc1..d8323c6f6646b85db3a882e21cc986826eb9e18e 100644 (file)
@@ -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;
        }