From: Aram Sargsyan Date: Mon, 4 May 2026 11:45:21 +0000 (+0000) Subject: Fix a memory leak issue in catz_process_primaries() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83cd5b52b5b65bd567a6709988c86ae90e663d3f;p=thirdparty%2Fbind9.git Fix a memory leak issue in catz_process_primaries() Free the old version of the keyname (if it exists) before setting the new one. (cherry picked from commit 4576a67a935b59191119e1b3f8f1ebce1521f3c8) --- diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 2924a134628..37e940b2e95 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -1490,6 +1490,14 @@ catz_process_primaries(dns_catz_zone_t *catz, dns_ipkeylist_t *ipkl, if (i < ipkl->count) { /* we have this record already */ if (value->type == dns_rdatatype_txt) { + if (ipkl->keys[i] != NULL) { + if (dns_name_dynamic(ipkl->keys[i])) { + dns_name_free(ipkl->keys[i], + mctx); + } + isc_mem_put(mctx, ipkl->keys[i], + sizeof(*ipkl->keys[i])); + } ipkl->keys[i] = keyname; } else { /* A/AAAA */ memmove(&ipkl->addrs[i], &sockaddr,