]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fixed a possible reference leak in dns_resolver_create()
authorEvan Hunt <each@isc.org>
Tue, 10 May 2022 19:48:31 +0000 (12:48 -0700)
committerEvan Hunt <each@isc.org>
Fri, 13 May 2022 20:36:10 +0000 (13:36 -0700)
If an error occurred while creating the resolver, the mctx could
remain attached.

lib/dns/resolver.c

index c75505fa2996e7818c02c41fab713a20a16ba246..fe909eb1bfc3d77ccb4728aab09eaab034ed2311 100644 (file)
@@ -10234,10 +10234,6 @@ dns_resolver_create(dns_view_t *view, isc_taskmgr_t *taskmgr,
        res->quotaresp[dns_quotatype_zone] = DNS_R_DROP;
        res->quotaresp[dns_quotatype_server] = DNS_R_SERVFAIL;
        isc_refcount_init(&res->references, 1);
-       atomic_init(&res->exiting, false);
-       atomic_init(&res->priming, false);
-       atomic_init(&res->zspill, 0);
-       atomic_init(&res->nfctx, 0);
        ISC_LIST_INIT(res->whenshutdown);
        ISC_LIST_INIT(res->alternates);
 
@@ -10343,8 +10339,7 @@ cleanup_buckets:
        dns_badcache_destroy(&res->badcache);
 
 cleanup_res:
-       isc_mem_put(view->mctx, res, sizeof(*res));
-
+       isc_mem_putanddetach(&res->mctx, res, sizeof(*res));
        return (result);
 }