fix: usr: Fix potential resource during resolver error handling

Under specific error conditions during query processing, resources were not
being properly released, which could eventually lead to unnecessary memory
consumption for the server.  The a potential resource leak in the resolver
has been fixed.

Merge branch 'ondrej/fix-pthread-primitives-usage' into 'main'

See merge request isc-projects/bind9!11658
This commit is contained in:
Ondřej Surý 2026-03-17 16:40:29 +01:00
commit 97e78c6bf4
3 changed files with 4 additions and 1 deletions

View file

@ -3973,6 +3973,7 @@ main(int argc, char *argv[]) {
&sign_finish);
}
isc_mutex_destroy(&namelock);
isc_rwlock_destroy(&keylist_lock);
return vresult == ISC_R_SUCCESS ? 0 : 1;
}

View file

@ -240,7 +240,7 @@ delete_ds(dns_qp_t *qp, dns_keytable_t *keytable, dns_keynode_t *knode,
result = dns_rdata_fromstruct(&dsrdata, dns_rdataclass_in,
dns_rdatatype_ds, ds, &b);
if (result != ISC_R_SUCCESS) {
RWUNLOCK(&knode->rwlock, isc_rwlocktype_write);
RWUNLOCK(&knode->rwlock, isc_rwlocktype_read);
return result;
}

View file

@ -5121,6 +5121,8 @@ cleanup_nameservers:
fetchctx_detach(&fctx->parent);
}
dns_ede_invalidate(&fctx->edectx);
isc_mutex_destroy(&fctx->lock);
dns_resolver_detach(&fctx->res);
isc_mem_putanddetach(&fctx->mctx, fctx, sizeof(*fctx));