From e4b5ca92ea33c3a08403b84f6b5260ba89206d8c Mon Sep 17 00:00:00 2001
From: Mark Andrews <marka@isc.org>
Date: Thu, 23 Feb 2023 15:43:51 +1100
Subject: [PATCH] Fix backport error in
 84929d1cd7e1042452094ceeae969324b9df504f

Not all the RETERR's in named_zone_configure where converted to
CHECK's, as was the case in main, leading to a memory leak with
the early returns.

Conflict: The content of the patch has not been changed, the patch context does not match, it is suitable for the patch 
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/e4b5ca92ea33c3a08403b84f6b5260ba89206d8c

---
 bin/named/zoneconf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c
index 8656602..8de3a88 100644
--- a/bin/named/zoneconf.c
+++ b/bin/named/zoneconf.c
@@ -1272,9 +1272,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
 				zone, ipkl.addrs, ipkl.dscps, ipkl.keys,
 				ipkl.count);
 			dns_ipkeylist_clear(mctx, &ipkl);
-			RETERR(result);
+			CHECK(result);
 		} else {
-			RETERR(dns_zone_setalsonotify(zone, NULL, 0));
+			CHECK(dns_zone_setalsonotify(zone, NULL, 0));
 		}
 
 		obj = NULL;
@@ -1721,9 +1721,9 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
 			result = dns_zone_setparentals(zone, ipkl.addrs,
 						       ipkl.keys, ipkl.count);
 			dns_ipkeylist_clear(mctx, &ipkl);
-			RETERR(result);
+			CHECK(result);
 		} else {
-			RETERR(dns_zone_setparentals(zone, NULL, NULL, 0));
+			CHECK(dns_zone_setparentals(zone, NULL, NULL, 0));
 		}
 	}
 
@@ -1936,11 +1936,11 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
 				mayberaw, ipkl.addrs, ipkl.keys, ipkl.count);
 			count = ipkl.count;
 			dns_ipkeylist_clear(mctx, &ipkl);
-			RETERR(result);
+			CHECK(result);
 		} else {
 			result = dns_zone_setprimaries(mayberaw, NULL, 0);
 		}
-		RETERR(result);
+		CHECK(result);
 
 		multi = false;
 		if (count > 1) {
-- 
2.33.0

