]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove an unnecessary NULL-check
authorAram Sargsyan <aram@isc.org>
Wed, 6 Sep 2023 10:26:36 +0000 (10:26 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 14 Sep 2023 10:39:24 +0000 (10:39 +0000)
In the ns__client_put_cb() callback function the 'client->manager'
pointer is guaranteed to be non-NULL, because in ns__client_request(),
before setting up the callback, the ns__client_setup() function is
called for the 'client', which makes sure that 'client->manager' is set.

Removing the NULL-check resolves the following static analyzer warning:

    /lib/ns/client.c: 1675 in ns__client_put_cb()
    1669      dns_message_puttemprdataset(client->message, &client->opt);
    1670      }
    1671      client_extendederror_reset(client);
    1672
    1673      dns_message_detach(&client->message);
    1674
    >>>     CID 465168:  Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "client->manager" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    1675      if (client->manager != NULL) {
    1676      ns_clientmgr_detach(&client->manager);
    1677      }
    1678
    1679      /*
    1680       * Detaching the task must be done after unlinking from

lib/ns/client.c

index 5ed64fd73b250c999bf909c9950df2341a612e00..1d26b336b35dcea0fe51139ca93c253832099de8 100644 (file)
@@ -1672,9 +1672,7 @@ ns__client_put_cb(void *client0) {
 
        dns_message_detach(&client->message);
 
-       if (client->manager != NULL) {
-               ns_clientmgr_detach(&client->manager);
-       }
+       ns_clientmgr_detach(&client->manager);
 
        /*
         * Detaching the task must be done after unlinking from