]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
'stub' cannot be non NULL, remove test.
authorMark Andrews <marka@isc.org>
Wed, 5 Feb 2020 05:28:56 +0000 (16:28 +1100)
committerMark Andrews <marka@isc.org>
Wed, 5 Feb 2020 07:37:17 +0000 (18:37 +1100)
13429 cleanup:
13430        cancel_refresh(zone);

CID 1452702 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking stub suggests that it may
be null, but it has already been dereferenced on all paths
leading to the check.

13431        if (stub != NULL) {
13432                stub->magic = 0;

lib/dns/zone.c

index f55be93ff8b9fdbce1e84a043f7977df227c3619..b63e1b889b9b4ecec8475145cb5caaf797f0014b 100644 (file)
@@ -13428,17 +13428,18 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
 
  cleanup:
        cancel_refresh(zone);
-       if (stub != NULL) {
-               stub->magic = 0;
-               if (stub->version != NULL)
-                       dns_db_closeversion(stub->db, &stub->version,
-                                           false);
-               if (stub->db != NULL)
-                       dns_db_detach(&stub->db);
-               if (stub->zone != NULL)
-                       zone_idetach(&stub->zone);
-               isc_mem_put(stub->mctx, stub, sizeof(*stub));
+       stub->magic = 0;
+       if (stub->version != NULL) {
+               dns_db_closeversion(stub->db, &stub->version,
+                                   false);
+       }
+       if (stub->db != NULL) {
+               dns_db_detach(&stub->db);
+       }
+       if (stub->zone != NULL) {
+               zone_idetach(&stub->zone);
        }
+       isc_mem_put(stub->mctx, stub, sizeof(*stub));
        if (message != NULL)
                dns_message_destroy(&message);
  unlock: