From 6f8fb0241a310cb2add5f98283b4e0a69b7c0add Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Mon, 27 Feb 2023 12:04:01 +0000 Subject: [PATCH 1/3] Fix a memory leak when isc_timer_create() fails in dns_catz_new_zone() Destroy 'new_zone->coos' in dns_catz_new_zone() on error path. --- lib/dns/catz.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 1c0dfc1621..f3396338a9 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -842,6 +842,7 @@ dns_catz_new_zone(dns_catz_zones_t *catzs, dns_catz_zone_t **zonep, cleanup_ht: isc_ht_destroy(&new_zone->entries); + isc_ht_destroy(&new_zone->coos); dns_name_free(&new_zone->name, catzs->mctx); isc_mem_put(catzs->mctx, new_zone, sizeof(*new_zone)); From 9050481d1f3db1a007fb02ab1b186af94d2de1bc Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Mon, 27 Feb 2023 12:06:37 +0000 Subject: [PATCH 2/3] Fix a cleanup bug when isc_task_create() fails in dns_catz_new_zones() Use isc_mem_putanddetach() instead of isc_mem_put() to detach from the memory context. --- lib/dns/catz.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/catz.c b/lib/dns/catz.c index f3396338a9..c5131d1489 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -779,7 +779,7 @@ cleanup_ht: isc_ht_destroy(&new_zones->zones); isc_refcount_destroy(&new_zones->refs); isc_mutex_destroy(&new_zones->lock); - isc_mem_put(mctx, new_zones, sizeof(*new_zones)); + isc_mem_putanddetach(&new_zones->mctx, new_zones, sizeof(*new_zones)); return (result); } From d96d8dc651a2685d772d0cd92b1d7cf9db7fd883 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Mon, 27 Feb 2023 12:11:02 +0000 Subject: [PATCH 3/3] Add a CHANGES note for [GL #3900] --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 90b2def77d..114f130831 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +6116. [bug] Fix error path cleanup issues in dns_catz_new_zones() + and dns_catz_new_zone() functions. [GL #3900] + 6105. [bug] Detach 'rpzs' and 'catzs' from the previous view in configure_rpz() and configure_catz(), respectively, just after attaching it to the new view. [GL #3880]