From dcc0835a3af2774128674fd4de25461609223d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Kr=C4=99cicki?= Date: Thu, 16 Jan 2020 11:53:31 +0100 Subject: [PATCH] cleanup properly if we fail to initialize ns_client structure If taskmgr is shutting down ns_client_setup will fail to create a task for the newly created client, we weren't cleaning up already created/attached things (memory context, server, clientmgr). --- lib/ns/client.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ns/client.c b/lib/ns/client.c index ad99883a23..9ef8afa094 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -2333,6 +2333,16 @@ ns__client_setup(ns_client_t *client, ns_clientmgr_t *mgr, bool new) { isc_task_detach(&client->task); } + if (client->manager != NULL) { + clientmgr_detach(&client->manager); + } + if (client->mctx != NULL) { + isc_mem_detach(&client->mctx); + } + if (client->sctx != NULL) { + ns_server_detach(&client->sctx); + } + return (result); }