]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove redundant 'version == NULL' check
authorMark Andrews <marka@isc.org>
Wed, 3 Feb 2021 05:38:29 +0000 (16:38 +1100)
committerMark Andrews <marka@isc.org>
Mon, 8 Feb 2021 05:17:52 +0000 (16:17 +1100)
    *** CID 318094:  Null pointer dereferences  (REVERSE_INULL)
    /lib/dns/rbtdb.c: 1389 in newversion()
    1383      version->xfrsize = rbtdb->current_version->xfrsize;
    1384      RWUNLOCK(&rbtdb->current_version->rwlock, isc_rwlocktype_read);
    1385      rbtdb->next_serial++;
    1386      rbtdb->future_version = version;
    1387      RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write);
    1388
       CID 318094:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "version" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    1389      if (version == NULL) {
    1390      return (result);
    1391      }
    1392
    1393      *versionp = version;
    1394

(cherry picked from commit 456d53d1fb2cd32bef2cc5a0906d9c08e215389b)

lib/dns/rbtdb.c

index 3577de335c077e55478999811aa80729b4a775ef..eb7191937933fed106498b7d294028242ac60937 100644 (file)
@@ -1348,7 +1348,6 @@ allocate_version(isc_mem_t *mctx, rbtdb_serial_t serial,
 
 static isc_result_t
 newversion(dns_db_t *db, dns_dbversion_t **versionp) {
-       isc_result_t result = ISC_R_SUCCESS;
        dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
        rbtdb_version_t *version;
 
@@ -1387,10 +1386,6 @@ newversion(dns_db_t *db, dns_dbversion_t **versionp) {
        rbtdb->future_version = version;
        RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write);
 
-       if (version == NULL) {
-               return (result);
-       }
-
        *versionp = version;
 
        return (ISC_R_SUCCESS);