Blob Blame History Raw
Written-by: Tomas Mraz <tmraz@redhat.com>
Reviewed-by: Adam Tkac <atkac@redhat.com>

diff -up bind-9.5.0a6/lib/dns/resolver.c.badfree bind-9.5.0a6/lib/dns/resolver.c
--- bind-9.5.0a6/lib/dns/resolver.c.badfree	2007-06-19 01:47:41.000000000 +0200
+++ bind-9.5.0a6/lib/dns/resolver.c	2007-09-05 16:20:21.000000000 +0200
@@ -7455,17 +7455,17 @@ dns_resolver_createdispatchpool(dns_reso
 	return (result);
 
   cleanup:
-	for (i = 0; i < ndisps; i++) {
-		if (res->dispatchv4pool[i] != NULL)
-			dns_dispatch_detach(&res->dispatchv4pool[i]);
-		if (res->dispatchv6pool[i] != NULL)
-			dns_dispatch_detach(&res->dispatchv6pool[i]);
-	}
 	if (res->dispatchv4pool != NULL) {
+		for (i = 0; i < ndisps; i++)
+			if (res->dispatchv4pool[i] != NULL)
+				dns_dispatch_detach(&res->dispatchv4pool[i]);
 		isc_mem_put(res->mctx, res->dispatchv4pool,
 			    sizeof(dns_dispatch_t *) * ndisps);
 	}
 	if (res->dispatchv6pool != NULL) {
+		for (i = 0; i < ndisps; i++)
+			if (res->dispatchv6pool[i] != NULL)
+				dns_dispatch_detach(&res->dispatchv6pool[i]);
 		isc_mem_put(res->mctx, res->dispatchv6pool,
 			    sizeof(dns_dispatch_t *) * ndisps);
 	}