From: Aram Sargsyan Date: Thu, 28 Sep 2023 13:43:18 +0000 (+0000) Subject: Remove unnecessary NULL-checks in ns__client_setup() X-Git-Tag: v9.19.18~57^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b970556f214d295957f04e29cd582ec7a02ff399;p=thirdparty%2Fbind9.git Remove unnecessary NULL-checks in ns__client_setup() All these pointers are guaranteed to be non-NULL. Additionally, update a comment to remove obviously outdated information about the function's requirements. --- diff --git a/lib/ns/client.c b/lib/ns/client.c index 283e6b000e9..7bd91405cd6 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -2290,11 +2290,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) { @@ -2358,18 +2355,10 @@ 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->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); + ns_clientmgr_detach(&client->manager); return (result); }