From 466a05eaf0070f6984d50428454ab399258da5e1 Mon Sep 17 00:00:00 2001
From: Aram Sargsyan <aram@isc.org>
Date: Mon, 27 Feb 2023 12:06:37 +0000
Subject: [PATCH] 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.

Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/466a05eaf0070f6984d50428454ab399258da5e1

(cherry picked from commit 9050481d1f3db1a007fb02ab1b186af94d2de1bc)
---
 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 92823a3..eb28838 100644
--- a/lib/dns/catz.c
+++ b/lib/dns/catz.c
@@ -661,7 +661,7 @@ cleanup_ht:
 cleanup_refcount:
 	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);
 }
-- 
2.33.0

