From: Mark Andrews Date: Wed, 5 Feb 2020 05:28:56 +0000 (+1100) Subject: 'stub' cannot be non NULL, remove test. X-Git-Tag: v9.16.0~29^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e189bb053dcc1be16db9c6a0d23755fdb892069;p=thirdparty%2Fbind9.git 'stub' cannot be non NULL, remove test. 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; --- diff --git a/lib/dns/zone.c b/lib/dns/zone.c index f55be93ff8b..b63e1b889b9 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -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: