@@ -425,7 +425,7 @@ nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
425
425
{
426
426
struct query_info qinfo ;
427
427
struct reply_info * rep = NULL ;
428
- struct ub_packed_rrset_key * answer , * nsec3 ;
428
+ struct ub_packed_rrset_key * answer , * nsec3 , * nsec3_region ;
429
429
struct nsec3_cached_hash * hash = NULL ;
430
430
int ret ;
431
431
uint8_t * qname ;
@@ -443,7 +443,11 @@ nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
443
443
/* check test is OK */
444
444
unit_assert (nsec3 && answer && qname );
445
445
446
- ret = nsec3_hash_name (ct , region , buf , nsec3 , 0 , qname ,
446
+ /* Copy the nsec3 to the region, so it can stay referenced by the
447
+ * ct tree entry. The region is freed when the file is done. */
448
+ nsec3_region = packed_rrset_copy_region (nsec3 , region , 0 );
449
+
450
+ ret = nsec3_hash_name (ct , region , buf , nsec3_region , 0 , qname ,
447
451
qinfo .qname_len , & hash );
448
452
if (ret < 1 ) {
449
453
printf ("Bad nsec3_hash_name retcode %d\n" , ret );
@@ -458,7 +462,6 @@ nsec3_hash_test_entry(struct entry* e, rbtree_type* ct,
458
462
459
463
reply_info_parsedelete (rep , alloc );
460
464
query_info_clear (& qinfo );
461
- rbtree_init (ct , & nsec3_hash_cmp ); /* remove refs freed by parsedelete */
462
465
}
463
466
464
467
0 commit comments