2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 23:15:18 +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're minimizing and we're not yet at the final NS -
* we need to launch a query for NS for 'upper' domain * we need to launch a query for NS for 'upper' domain
*/ */
if (fctx->minimized == true) { if (fctx->minimized) {
unsigned int options = fctx->options; unsigned int options = fctx->options;
options &= ~DNS_FETCHOPT_QMINIMIZE; options &= ~DNS_FETCHOPT_QMINIMIZE;
fctx_increference(fctx); fctx_increference(fctx);
task = res->buckets[bucketnum].task; task = res->buckets[bucketnum].task;
result = dns_resolver_createfetch(fctx->res, &fctx->qminname, result = dns_resolver_createfetch(fctx->res, &fctx->qminname,
fctx->qmintype, &fctx->domain, fctx->qmintype, &fctx->domain,
&fctx->nameservers, NULL, fctx->client, &fctx->nameservers, NULL,
fctx->id, options, 0, fctx->client, fctx->id,
fctx->qc, task, resume_qmin, options, 0, fctx->qc, task,
fctx, &fctx->qminrrset, resume_qmin, fctx,
NULL, &fctx->qminfetch); &fctx->qminrrset, NULL,
&fctx->qminfetch);
if (result != ISC_R_SUCCESS) { 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__); fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
} }
return; return;
@@ -4103,7 +4107,9 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
if (result == ISC_R_CANCELED) { if (result == ISC_R_CANCELED) {
fctx_done(fctx, result, __LINE__); fctx_done(fctx, result, __LINE__);
goto cleanup; goto cleanup;
} else if (NXDOMAIN_RESULT(result) || result == DNS_R_FORMERR || }
if (NXDOMAIN_RESULT(result) || result == DNS_R_FORMERR ||
result == DNS_R_REMOTEFORMERR) result == DNS_R_REMOTEFORMERR)
{ {
if ((fctx->options & DNS_FETCHOPT_QMIN_STRICT) == 0) { if ((fctx->options & DNS_FETCHOPT_QMIN_STRICT) == 0) {
@@ -4118,7 +4124,6 @@ resume_qmin(isc_task_t *task, isc_event_t *event) {
} }
} }
if (dns_rdataset_isassociated(&fctx->nameservers)) { if (dns_rdataset_isassociated(&fctx->nameservers)) {
dns_rdataset_disassociate(&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) { if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__); fctx_done(fctx, result, __LINE__);
return; goto cleanup;
} }
fcount_decr(fctx); fcount_decr(fctx);
dns_name_free(&fctx->domain, fctx->mctx); 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); result = dns_name_dup(fname, fctx->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__); fctx_done(fctx, result, __LINE__);
return; goto cleanup;
} }
dns_name_free(&fctx->qmindcname, fctx->mctx); dns_name_free(&fctx->qmindcname, fctx->mctx);
dns_name_init(&fctx->qmindcname, NULL); dns_name_init(&fctx->qmindcname, NULL);
result = dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname); result = dns_name_dup(dcname, fctx->mctx, &fctx->qmindcname);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fctx_done(fctx, result, __LINE__); fctx_done(fctx, result, __LINE__);
return; goto cleanup;
} }
fctx->ns_ttl = fctx->nameservers.ttl; fctx->ns_ttl = fctx->nameservers.ttl;
fctx->ns_ttl_ok = true; fctx->ns_ttl_ok = true;
@@ -4404,6 +4409,9 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) {
if (fctx->nsfetch != NULL) if (fctx->nsfetch != NULL)
dns_resolver_cancelfetch(fctx->nsfetch); dns_resolver_cancelfetch(fctx->nsfetch);
if (fctx->qminfetch != NULL)
dns_resolver_cancelfetch(fctx->qminfetch);
/* /*
* Shut down anything still running on behalf of this * Shut down anything still running on behalf of this
* fetch, and clean up finds and addresses. To avoid deadlock * fetch, and clean up finds and addresses. To avoid deadlock