]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix Coverity CID 487884: Dead code in qpcache.c
authorMatthijs Mekking <matthijs@isc.org>
Tue, 12 Mar 2024 13:12:23 +0000 (14:12 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Thu, 14 Mar 2024 10:42:30 +0000 (10:42 +0000)
Adding a changed record is zonedb related and does not belong in
the cache code. This is a leftover dead code and can be safely
removed.

/lib/dns/qpcache.c: 3459 in add()
3453      }
3454      newheader->next = topheader->next;
3455      newheader->down = topheader;
3456      topheader->next = newheader;
3457      qpnode->dirty = 1;
3458      if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3459      changed->dirty = true;
3460      }
3461      } else {
3462      /*
3463       * No rdatasets of the given type exist at the node.
3464       */
/lib/dns/qpcache.c: 3409 in add()
3403      }
3404      newheader->next = topheader->next;
3405      newheader->down = topheader;
3406      topheader->next = newheader;
3407      qpnode->dirty = 1;
3408      if (changed != NULL) {
>>>     CID 487884:    (DEADCODE)
>>>     Execution cannot reach this statement: "changed->dirty = true;".
3409      changed->dirty = true;
3410      }
3411      mark_ancient(header);
3412      if (sigheader != NULL) {
3413      mark_ancient(sigheader);
3414

lib/dns/qpcache.c

index f9e2d379a2df19b9479fec9d7c18dfad0e7281aa..481a20ad0bb7f9e23997cda0c0ac079bed6f26af 100644 (file)
@@ -3072,7 +3072,6 @@ add(dns_qpdb_t *qpdb, dns_qpdata_t *qpnode,
     const dns_name_t *nodename ISC_ATTR_UNUSED, dns_slabheader_t *newheader,
     unsigned int options, bool loading, dns_rdataset_t *addedrdataset,
     isc_stdtime_t now DNS__DB_FLARG) {
-       qpdb_changed_t *changed = NULL;
        dns_slabheader_t *topheader = NULL, *topheader_prev = NULL;
        dns_slabheader_t *header = NULL, *sigheader = NULL;
        dns_slabheader_t *prioheader = NULL;
@@ -3405,9 +3404,6 @@ find_header:
                        newheader->down = topheader;
                        topheader->next = newheader;
                        qpnode->dirty = 1;
-                       if (changed != NULL) {
-                               changed->dirty = true;
-                       }
                        mark_ancient(header);
                        if (sigheader != NULL) {
                                mark_ancient(sigheader);
@@ -3455,9 +3451,6 @@ find_header:
                        newheader->down = topheader;
                        topheader->next = newheader;
                        qpnode->dirty = 1;
-                       if (changed != NULL) {
-                               changed->dirty = true;
-                       }
                } else {
                        /*
                         * No rdatasets of the given type exist at the node.