]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove unnecessary NULL-checks in ns__client_setup()
authorAram Sargsyan <aram@isc.org>
Thu, 28 Sep 2023 13:43:18 +0000 (13:43 +0000)
committerAram Sargsyan <aram@isc.org>
Mon, 2 Oct 2023 10:04:56 +0000 (10:04 +0000)
All these pointers are guaranteed to be non-NULL.

Additionally, update a comment to remove obviously outdated
information about the function's requirements.

(cherry picked from commit b970556f214d295957f04e29cd582ec7a02ff399)

lib/ns/client.c

index 1d26b336b35dcea0fe51139ca93c253832099de8..a62343bc7b65e269542df9ad342d52b92bfd6f44 100644 (file)
@@ -2320,11 +2320,8 @@ ns__client_setup(ns_client_t *client, ns_clientmgr_t *mgr, bool new) {
        isc_result_t result;
 
        /*
-        * Caller must be holding the manager lock.
-        *
         * Note: creating a client does not add the client to the
-        * manager's client list or set the client's manager pointer.
-        * The caller is responsible for that.
+        * manager's client list, the caller is responsible for that.
         */
 
        if (new) {
@@ -2400,26 +2397,13 @@ ns__client_setup(ns_client_t *client, ns_clientmgr_t *mgr, bool new) {
        return (ISC_R_SUCCESS);
 
 cleanup:
-       if (client->sendbuf != NULL) {
-               isc_mem_put(client->manager->send_mctx, client->sendbuf,
-                           NS_CLIENT_SEND_BUFFER_SIZE);
-       }
-
-       if (client->message != NULL) {
-               dns_message_detach(&client->message);
-       }
-
-       if (client->task != NULL) {
-               isc_task_detach(&client->task);
-       }
-
-       if (client->manager != NULL) {
-               ns_clientmgr_detach(&client->manager);
-       }
+       isc_mem_put(client->manager->send_mctx, client->sendbuf,
+                   NS_CLIENT_SEND_BUFFER_SIZE);
+       dns_message_detach(&client->message);
+       isc_task_detach(&client->task);
+       ns_clientmgr_detach(&client->manager);
        isc_mem_detach(&client->mctx);
-       if (client->sctx != NULL) {
-               ns_server_detach(&client->sctx);
-       }
+       ns_server_detach(&client->sctx);
 
        return (result);
 }