2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

initialize header in dns_rdataslab_fromrdataset()

when dns_rdataslab_fromrdataset() is run, in addition to
allocating space for a slab header, it also partially
initializes it, setting the type match rdataset->type and
rdataset->covers, the trust to rdataset->trust, and the TTL to
rdataset->ttl.
This commit is contained in:
Evan Hunt
2025-02-07 21:06:34 -08:00
parent b4bde9bef4
commit 82edec67a5
4 changed files with 37 additions and 34 deletions

View File

@@ -302,7 +302,22 @@ free_rdatas:
isc_result_t
dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
isc_region_t *region, uint32_t maxrrperset) {
return makeslab(rdataset, mctx, region, maxrrperset, false);
isc_result_t result;
result = makeslab(rdataset, mctx, region, maxrrperset, false);
if (result == ISC_R_SUCCESS) {
dns_slabheader_t *new = (dns_slabheader_t *)region->base;
*new = (dns_slabheader_t){
.type = DNS_TYPEPAIR_VALUE(rdataset->type,
rdataset->covers),
.trust = rdataset->trust,
.ttl = rdataset->ttl,
.link = ISC_LINK_INITIALIZER,
};
}
return result;
}
isc_result_t