]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix outstanding cppcheck errors
authorEvan Hunt <each@isc.org>
Mon, 4 May 2020 21:23:23 +0000 (14:23 -0700)
committerEvan Hunt <each@isc.org>
Mon, 4 May 2020 21:23:23 +0000 (14:23 -0700)
lib/dns/sdb.c:1145:warning: Either the condition '(sdb)!=((void*)0)' is
redundant or there is possible null pointer dereference: sdb."

lib/dns/sdb.c:1208: Either the condition '(node)!=((void*)0)' is
redundant or there is possible null pointer dereference: sdbnode.

lib/dns/sdb.c

index d4c8c673c8207bf4eeece22be6efe27caf28ec82..8afaa52fb1bb0ec3774d67ceddb1de497d1afc39 100644 (file)
@@ -1141,11 +1141,13 @@ createiterator(dns_db_t *db, unsigned int options, dns_dbiterator_t **iteratorp)
 {
        dns_sdb_t *sdb = (dns_sdb_t *)db;
        sdb_dbiterator_t *sdbiter;
-       dns_sdbimplementation_t *imp = sdb->implementation;
+       dns_sdbimplementation_t *imp;
        isc_result_t result;
 
        REQUIRE(VALID_SDB(sdb));
 
+       imp = sdb->implementation;
+
        if (imp->methods->allnodes == NULL)
                return (ISC_R_NOTIMPLEMENTED);
 
@@ -1193,7 +1195,7 @@ findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
        dns_rdatalist_t *list;
        dns_sdbnode_t *sdbnode = (dns_sdbnode_t *)node;
 
-       REQUIRE(VALID_SDBNODE(node));
+       REQUIRE(VALID_SDBNODE(sdbnode));
 
        UNUSED(db);
        UNUSED(version);