]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove expired rdataset headers from the heap
authorOndřej Surý <ondrej@isc.org>
Tue, 20 Feb 2024 07:50:58 +0000 (08:50 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 29 Feb 2024 11:56:36 +0000 (12:56 +0100)
It was discovered that an expired header could sit on top of the heap
a little longer than desireable.  Remove expired headers (headers with
rdh_ttl set to 0) from the heap completely, so they don't block the next
TTL-based cleaning.

lib/dns/rbtdb.c

index 337ebbd8762755965646210710bdccdc7dab386f..d813bb4d89d2a3bc1215eb879bb0cfe95eeb27b2 100644 (file)
@@ -337,6 +337,10 @@ dns__rbtdb_setttl(dns_slabheader_t *header, dns_ttl_t newttl) {
        } else {
                isc_heap_decreased(header->heap, header->heap_index);
        }
+
+       if (newttl == 0) {
+               isc_heap_delete(header->heap, header->heap_index);
+       }
 }
 
 static bool
@@ -4851,7 +4855,6 @@ dns__rbtdb_deletedata(dns_db_t *db ISC_ATTR_UNUSED,
        if (header->heap != NULL && header->heap_index != 0) {
                isc_heap_delete(header->heap, header->heap_index);
        }
-       header->heap_index = 0;
 
        if (IS_CACHE(rbtdb)) {
                update_rrsetstats(rbtdb->rrsetstats, header->type,