]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix resquery reference imbalance on TCP connect failure
authorOndřej Surý <ondrej@isc.org>
Fri, 6 Mar 2026 16:06:24 +0000 (17:06 +0100)
committerOndřej Surý <ondrej@isc.org>
Tue, 10 Mar 2026 16:58:43 +0000 (17:58 +0100)
commit2da669490ca94b9617257a25d93a52ed67dfdd14
treecf3d510fa8922f0c0222814de6f5a65035b78ae1
parent0d28e1bed26c9828293ef786daf5574f7f31b918
Fix resquery reference imbalance on TCP connect failure

In fctx_query(), resquery_ref(query) is called before
dns_dispatch_connect() in anticipation of the resquery_connected()
callback consuming the reference.

When dns_dispatch_connect() fails synchronously on TCP (e.g. from
dns_transport_get_tlsctx() failing in tcp_dispatch_connect()), the
connect callback is never scheduled, so the extra reference is never
consumed.  The error path then tears down the query via manual cleanup
(isc_mem_put) without going through the refcount destructor, leaving
the reference imbalanced.

Fix by dropping the extra reference on the error path, just after
dns_dispatch_done() which cleans up the dispatch entry.
lib/dns/resolver.c