Adam Tkac bc3682
diff -up bind-9.7.0-P1/lib/dns/resolver.c.rh507429 bind-9.7.0-P1/lib/dns/resolver.c
Adam Tkac bc3682
--- bind-9.7.0-P1/lib/dns/resolver.c.rh507429	2010-03-26 14:53:12.776469537 +0100
Adam Tkac bc3682
+++ bind-9.7.0-P1/lib/dns/resolver.c	2010-03-26 15:07:18.363969402 +0100
Adam Tkac bc3682
@@ -6160,6 +6160,7 @@ resume_dslookup(isc_task_t *task, isc_ev
Adam Tkac bc3682
 	if (fevent->result == ISC_R_CANCELED) {
Adam Tkac bc3682
 		dns_resolver_destroyfetch(&fctx->nsfetch);
Adam Tkac bc3682
 		fctx_done(fctx, ISC_R_CANCELED, __LINE__);
Adam Tkac bc3682
+		goto cleanup;
Adam Tkac bc3682
 	} else if (fevent->result == ISC_R_SUCCESS) {
Adam Tkac bc3682
 
Adam Tkac bc3682
 		FCTXTRACE("resuming DS lookup");
Adam Tkac bc3682
@@ -6219,15 +6220,16 @@ resume_dslookup(isc_task_t *task, isc_ev
Adam Tkac bc3682
 						  resume_dslookup, fctx,
Adam Tkac bc3682
 						  &fctx->nsrrset, NULL,
Adam Tkac bc3682
 						  &fctx->nsfetch);
Adam Tkac bc3682
-		if (result != ISC_R_SUCCESS)
Adam Tkac bc3682
+		if (result != ISC_R_SUCCESS) {
Adam Tkac bc3682
 			fctx_done(fctx, result, __LINE__);
Adam Tkac bc3682
-		else {
Adam Tkac bc3682
-			LOCK(&res->buckets[bucketnum].lock);
Adam Tkac bc3682
-			locked = ISC_TRUE;
Adam Tkac bc3682
-			fctx->references++;
Adam Tkac bc3682
+			goto cleanup;
Adam Tkac bc3682
 		}
Adam Tkac bc3682
 	}
Adam Tkac bc3682
 
Adam Tkac bc3682
+	LOCK(&res->buckets[bucketnum].lock);
Adam Tkac bc3682
+	locked = ISC_TRUE;
Adam Tkac bc3682
+	fctx->references++;
Adam Tkac bc3682
+
Adam Tkac bc3682
  cleanup:
Adam Tkac bc3682
 	if (dns_rdataset_isassociated(&nameservers))
Adam Tkac bc3682
 		dns_rdataset_disassociate(&nameservers);