]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a memory leak issue in catz_process_primaries() 11974/head
authorAram Sargsyan <aram@isc.org>
Mon, 4 May 2026 11:45:21 +0000 (11:45 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 6 May 2026 18:38:43 +0000 (18:38 +0000)
Free the old version of the keyname (if it exists) before setting
the new one.

(cherry picked from commit 4576a67a935b59191119e1b3f8f1ebce1521f3c8)

lib/dns/catz.c

index fdc5eb879a1c18b6de3244c5d2cfe4d14e8a377d..c6e65bbfc26620cc73af705406e8a7f797751f58 100644 (file)
@@ -1492,6 +1492,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,