]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
don't set rdh_ttl in init_rdataset
authorMark Andrews <marka@isc.org>
Fri, 17 Apr 2015 13:09:05 +0000 (23:09 +1000)
committerMark Andrews <marka@isc.org>
Fri, 17 Apr 2015 13:09:05 +0000 (23:09 +1000)
lib/dns/rbtdb.c

index aadb481ba9633f012b1496cc24497bbafb0828c9..0782a8fb71049b098122d5c37548a52d5b37376d 100644 (file)
@@ -1031,11 +1031,14 @@ set_ttl(dns_rbtdb_t *rbtdb, rdatasetheader_t *header, dns_ttl_t newttl) {
        isc_heap_t *heap;
        dns_ttl_t oldttl;
 
-       oldttl = header->rdh_ttl;
-       header->rdh_ttl = newttl;
 
-       if (!IS_CACHE(rbtdb))
+       if (!IS_CACHE(rbtdb)) {
+               header->rdh_ttl = newttl;
                return;
+       }
+
+       oldttl = header->rdh_ttl;
+       header->rdh_ttl = newttl;
 
        /*
         * It's possible the rbtdb is not a cache.  If this is the case,
@@ -1555,7 +1558,6 @@ static inline void
 init_rdataset(dns_rbtdb_t *rbtdb, rdatasetheader_t *h) {
        ISC_LINK_INIT(h, link);
        h->heap_index = 0;
-       h->rdh_ttl = 0;
        h->is_mmapped = 0;
        h->next_is_relative = 0;
        h->node_is_relative = 0;
@@ -1605,6 +1607,7 @@ new_rdataset(dns_rbtdb_t *rbtdb, isc_mem_t *mctx) {
 #endif
        memset(h->upper, 0xeb, sizeof(h->upper));
        init_rdataset(rbtdb, h);
+       h->rdh_ttl = 0;
        return (h);
 }