]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix for #1183: release nsec3 hashes per test file.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 15 Nov 2024 09:47:27 +0000 (10:47 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 15 Nov 2024 09:47:27 +0000 (10:47 +0100)
doc/Changelog
testcode/unitverify.c

index 7b80f2c0e4b36d09cb75cb04aa03eff157ba9c92..4a9d8f902a770430a182bd1a3e8b5bb5c2b4a9d1 100644 (file)
@@ -1,6 +1,7 @@
 15 November 2024: Wouter
        - Fix #1183: the data being used is released in method
          nsec3_hash_test_entry.
+       - Fix for #1183: release nsec3 hashes per test file.
 
 8 November 2024: Yorgos
        - More descriptive text for 'harden-algo-downgrade'.
index 806e4a6ff92fdb146aac43738f67e22ac7935c41..81c8b13c6d659ceb4e552a27f4686029ec765cac 100644 (file)
@@ -425,7 +425,7 @@ nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
 {
        struct query_info qinfo;
        struct reply_info* rep = NULL;
-       struct ub_packed_rrset_key* answer, *nsec3;
+       struct ub_packed_rrset_key* answer, *nsec3, *nsec3_region;
        struct nsec3_cached_hash* hash = NULL;
        int ret;
        uint8_t* qname;
@@ -443,7 +443,11 @@ nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
        /* check test is OK */
        unit_assert(nsec3 && answer && qname);
 
-       ret = nsec3_hash_name(ct, region, buf, nsec3, 0, qname,
+       /* Copy the nsec3 to the region, so it can stay referenced by the
+        * ct tree entry. The region is freed when the file is done. */
+       nsec3_region = packed_rrset_copy_region(nsec3, region, 0);
+
+       ret = nsec3_hash_name(ct, region, buf, nsec3_region, 0, qname,
                qinfo.qname_len, &hash);
        if(ret < 1) {
                printf("Bad nsec3_hash_name retcode %d\n", ret);
@@ -458,7 +462,6 @@ nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
 
        reply_info_parsedelete(rep, alloc);
        query_info_clear(&qinfo);
-       rbtree_init(ct, &nsec3_hash_cmp); /* remove refs freed by parsedelete */
 }