2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

address fctx reference count leaks; style

This commit is contained in:
Mark Andrews
2018-08-15 15:49:33 +10:00
committed by Witold Kręcicki
parent f2af336dc4
commit 1a2a19c693

View File

@@ -3967,19 +3967,23 @@ fctx_try(fetchctx_t *fctx, bool retrying, bool badcache) {
* We're minimizing and we're not yet at the final NS -
* we need to launch a query for NS for 'upper' domain
*/
if (fctx->minimized == true) {
if (fctx->minimized) {
unsigned int options = fctx->options;
options &= ~DNS_FETCHOPT_QMINIMIZE;
fctx_increference(fctx);
task = res->buckets[bucketnum].task;
result = dns_resolver_createfetch(fctx->res, &fctx->qminname,
fctx->qmintype, &fctx->domain,
&fctx->nameservers, NULL, fctx->client,
fctx->id, options, 0,
fctx->qc, task, resume_qmin,
fctx, &fctx->qminrrset,
NULL, &fctx->qminfetch);
&fctx->nameservers, NULL,
fctx->client, fctx->id,
options, 0, fctx->qc, task,
resume_qmin, fctx,
&fctx->qminrrset, NULL,
&fctx->qminfetch);
if (result != ISC_R_SUCCESS) {
LOCK(&fctx->res->buckets[fctx->bucketnum].lock);
bucket_empty = fctx_decreference(fctx);
UNLOCK(&fctx->res->buckets[fctx->bucketnum].lock);
fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
}
return;
@@ -4103,8 +4107,10 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
if (result == ISC_R_CANCELED) {
fctx_done(fctx, result, __LINE__);
goto cleanup;
} else if (NXDOMAIN_RESULT(result) || result == DNS_R_FORMERR ||
result == DNS_R_REMOTEFORMERR)
}
if (NXDOMAIN_RESULT(result) || result == DNS_R_FORMERR ||
result == DNS_R_REMOTEFORMERR)
{
if ((fctx->options & DNS_FETCHOPT_QMIN_STRICT) == 0) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
@@ -4118,7 +4124,6 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
}
}
if (dns_rdataset_isassociated(&fctx->nameservers)) {
dns_rdataset_disassociate(&fctx->nameservers);
}
@@ -4132,7 +4137,7 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__);
return;
goto cleanup;
}
fcount_decr(fctx);
dns_name_free(&fctx->domain, fctx->mctx);
@@ -4140,14 +4145,14 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
result = dns_name_dup(fname, fctx->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__);
return;
goto cleanup;
}
dns_name_free(&fctx->qmindcname, fctx->mctx);
dns_name_init(&fctx->qmindcname, NULL);
result = dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__);
return;
goto cleanup;
}
fctx->ns_ttl = fctx->nameservers.ttl;
fctx->ns_ttl_ok = true;
@@ -4404,6 +4409,9 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) {
if (fctx->nsfetch != NULL)
dns_resolver_cancelfetch(fctx->nsfetch);
if (fctx->qminfetch != NULL)
dns_resolver_cancelfetch(fctx->qminfetch);
/*
* Shut down anything still running on behalf of this
* fetch, and clean up finds and addresses. To avoid deadlock