diff --git a/bin/named/client.c b/bin/named/client.c index 4c29c8ef47..cd2ea8cfc7 100644 --- a/bin/named/client.c +++ b/bin/named/client.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: client.c,v 1.138 2001/01/09 21:39:41 bwelling Exp $ */ +/* $Id: client.c,v 1.139 2001/01/16 23:02:58 gson Exp $ */ #include @@ -256,8 +256,6 @@ client_free(ns_client_t *client) { isc_buffer_free(&client->opt_view); #endif /* DNS_OPT_NEWCODES */ dns_message_destroy(&client->message); - if (client->task != NULL) - isc_task_detach(&client->task); if (client->manager != NULL) { manager = client->manager; LOCK(&manager->lock); @@ -269,6 +267,13 @@ client_free(ns_client_t *client) { need_clientmgr_destroy = ISC_TRUE; UNLOCK(&manager->lock); } + /* + * Detaching the task must be done after unlinking from + * the manager's lists because the manager accesses + * client->task. + */ + if (client->task != NULL) + isc_task_detach(&client->task); CTRACE("free"); client->magic = 0;