mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Put some missing dns_rdata_freestruct() calls in catz.c
A successful call to `dns_rdata_tostruct()` expects an accompanying call to `dns_rdata_freestruct()` to free up any memory that could have been allocated during the first call. In catz.c there are several places where `dns_rdata_freestruct()` call is skipped. Add the missing cleanup routines.
This commit is contained in:
@@ -1059,12 +1059,14 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||||||
result = dns_rdata_tostruct(&rdata, &rdata_a, NULL);
|
result = dns_rdata_tostruct(&rdata, &rdata_a, NULL);
|
||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
isc_sockaddr_fromin(&sockaddr, &rdata_a.in_addr, 0);
|
isc_sockaddr_fromin(&sockaddr, &rdata_a.in_addr, 0);
|
||||||
|
dns_rdata_freestruct(&rdata_a);
|
||||||
break;
|
break;
|
||||||
case dns_rdatatype_aaaa:
|
case dns_rdatatype_aaaa:
|
||||||
result = dns_rdata_tostruct(&rdata, &rdata_aaaa, NULL);
|
result = dns_rdata_tostruct(&rdata, &rdata_aaaa, NULL);
|
||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
isc_sockaddr_fromin6(&sockaddr, &rdata_aaaa.in6_addr,
|
isc_sockaddr_fromin6(&sockaddr, &rdata_aaaa.in6_addr,
|
||||||
0);
|
0);
|
||||||
|
dns_rdata_freestruct(&rdata_aaaa);
|
||||||
break;
|
break;
|
||||||
case dns_rdatatype_txt:
|
case dns_rdatatype_txt:
|
||||||
result = dns_rdata_tostruct(&rdata, &rdata_txt, NULL);
|
result = dns_rdata_tostruct(&rdata, &rdata_txt, NULL);
|
||||||
@@ -1072,16 +1074,19 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||||||
|
|
||||||
result = dns_rdata_txt_first(&rdata_txt);
|
result = dns_rdata_txt_first(&rdata_txt);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
dns_rdata_freestruct(&rdata_txt);
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_rdata_txt_current(&rdata_txt, &rdatastr);
|
result = dns_rdata_txt_current(&rdata_txt, &rdatastr);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
dns_rdata_freestruct(&rdata_txt);
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_rdata_txt_next(&rdata_txt);
|
result = dns_rdata_txt_next(&rdata_txt);
|
||||||
if (result != ISC_R_NOMORE) {
|
if (result != ISC_R_NOMORE) {
|
||||||
|
dns_rdata_freestruct(&rdata_txt);
|
||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1090,6 +1095,7 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||||||
dns_name_init(keyname, 0);
|
dns_name_init(keyname, 0);
|
||||||
memmove(keycbuf, rdatastr.data, rdatastr.length);
|
memmove(keycbuf, rdatastr.data, rdatastr.length);
|
||||||
keycbuf[rdatastr.length] = 0;
|
keycbuf[rdatastr.length] = 0;
|
||||||
|
dns_rdata_freestruct(&rdata_txt);
|
||||||
result = dns_name_fromstring(keyname, keycbuf, 0, mctx);
|
result = dns_name_fromstring(keyname, keycbuf, 0, mctx);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
dns_name_free(keyname, mctx);
|
dns_name_free(keyname, mctx);
|
||||||
@@ -1167,16 +1173,17 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
isc_sockaddr_fromin(&ipkl->addrs[ipkl->count],
|
isc_sockaddr_fromin(&ipkl->addrs[ipkl->count],
|
||||||
&rdata_a.in_addr, 0);
|
&rdata_a.in_addr, 0);
|
||||||
|
dns_rdata_freestruct(&rdata_a);
|
||||||
} else {
|
} else {
|
||||||
result = dns_rdata_tostruct(&rdata, &rdata_aaaa, NULL);
|
result = dns_rdata_tostruct(&rdata, &rdata_aaaa, NULL);
|
||||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||||
isc_sockaddr_fromin6(&ipkl->addrs[ipkl->count],
|
isc_sockaddr_fromin6(&ipkl->addrs[ipkl->count],
|
||||||
&rdata_aaaa.in6_addr, 0);
|
&rdata_aaaa.in6_addr, 0);
|
||||||
|
dns_rdata_freestruct(&rdata_aaaa);
|
||||||
}
|
}
|
||||||
ipkl->keys[ipkl->count] = NULL;
|
ipkl->keys[ipkl->count] = NULL;
|
||||||
ipkl->labels[ipkl->count] = NULL;
|
ipkl->labels[ipkl->count] = NULL;
|
||||||
ipkl->count++;
|
ipkl->count++;
|
||||||
dns_rdata_freestruct(&rdata_a);
|
|
||||||
}
|
}
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -1418,6 +1425,7 @@ dns_catz_update_process(dns_catz_zones_t *catzs, dns_catz_zone_t *zone,
|
|||||||
/*
|
/*
|
||||||
* xxxwpk TODO do we want to save something from SOA?
|
* xxxwpk TODO do we want to save something from SOA?
|
||||||
*/
|
*/
|
||||||
|
dns_rdata_freestruct(&soa);
|
||||||
return (result);
|
return (result);
|
||||||
} else if (rdataset->type == dns_rdatatype_ns) {
|
} else if (rdataset->type == dns_rdatatype_ns) {
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
Reference in New Issue
Block a user