INSIST(client->recursionquota == NULL);
INSIST(!ISC_QLINK_LINKED(client, ilink));
+ if (manager != NULL) {
+ LOCK(&manager->listlock);
+ ISC_LIST_UNLINK(manager->clients, client, link);
+ LOCK(&manager->lock);
+ if (manager->exiting &&
+ ISC_LIST_EMPTY(manager->clients))
+ destroy_manager = ISC_TRUE;
+ UNLOCK(&manager->lock);
+ UNLOCK(&manager->listlock);
+ }
+
ns_query_free(client);
isc_mem_put(client->mctx, client->recvbuf, RECV_BUFFER_SIZE);
isc_event_free((isc_event_t **)&client->sendevent);
}
dns_message_destroy(&client->message);
- if (manager != NULL) {
- LOCK(&manager->listlock);
- ISC_LIST_UNLINK(manager->clients, client, link);
- LOCK(&manager->lock);
- if (manager->exiting &&
- ISC_LIST_EMPTY(manager->clients))
- destroy_manager = ISC_TRUE;
- UNLOCK(&manager->lock);
- UNLOCK(&manager->listlock);
- }
/*
* Detaching the task must be done after unlinking from
isc_mem_stats(client->mctx, stderr);
INSIST(0);
}
+
+ /*
+ * Destroy the fetchlock mutex that was created in
+ * ns_query_init().
+ */
+ DESTROYLOCK(&client->query.fetchlock);
+
isc_mem_putanddetach(&client->mctx, client, sizeof(*client));
}
client->query.timerset = ISC_FALSE;
client->query.rpz_st = NULL;
client->query.qname = NULL;
+ /*
+ * This mutex is destroyed when the client is destroyed in
+ * exit_check().
+ */
result = isc_mutex_init(&client->query.fetchlock);
if (result != ISC_R_SUCCESS)
return (result);
return (result);
}
result = query_newnamebuf(client);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
query_freefreeversions(client, ISC_TRUE);
+ DESTROYLOCK(&client->query.fetchlock);
+ }
return (result);
}