]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix gaining adbname reference
authorMark Andrews <marka@isc.org>
Wed, 19 Mar 2025 02:31:35 +0000 (13:31 +1100)
committerMark Andrews <marka@isc.org>
Thu, 20 Mar 2025 23:25:29 +0000 (23:25 +0000)
Call dns_adbname_ref before calling dns_resolver_createfetch to
ensure adbname->name remains stable for the life of the fetch.

lib/dns/adb.c

index d32c56f3b711721305c25ccb53b7c45da9e86f7f..55dfd83f842f24946841f41ec7ca9f8d655d6efb 100644 (file)
@@ -2909,6 +2909,7 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, bool no_validation,
         * createfetch to find deepest cached name when we're providing
         * domain and nameservers.
         */
+       dns_adbname_ref(adbname);
        result = dns_resolver_createfetch(
                adb->res, adbname->name, type, name, nameservers, NULL, NULL, 0,
                options, depth, qc, gqc, isc_loop(), fetch_callback, adbname,
@@ -2916,11 +2917,10 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, bool no_validation,
        if (result != ISC_R_SUCCESS) {
                DP(ENTER_LEVEL, "fetch_name: createfetch failed with %s",
                   isc_result_totext(result));
+               dns_adbname_unref(adbname);
                goto cleanup;
        }
 
-       dns_adbname_ref(adbname);
-
        if (type == dns_rdatatype_a) {
                adbname->fetch_a = fetch;
                inc_resstats(adb, dns_resstatscounter_gluefetchv4);