mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
Fix a leak of query fetchlock (#38454)
4052. [bug] Fix a leak of query fetchlock. [RT #38454]
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,3 +1,5 @@
|
|||||||
|
4052. [bug] Fix a leak of query fetchlock. [RT #38454]
|
||||||
|
|
||||||
4051. [bug] Fix a leak of pthread_mutexattr_t. [RT #38454]
|
4051. [bug] Fix a leak of pthread_mutexattr_t. [RT #38454]
|
||||||
|
|
||||||
4050. [cleanup] Silence occasional spurious "duplicate query" log
|
4050. [cleanup] Silence occasional spurious "duplicate query" log
|
||||||
|
@@ -556,6 +556,17 @@ exit_check(ns_client_t *client) {
|
|||||||
INSIST(client->recursionquota == NULL);
|
INSIST(client->recursionquota == NULL);
|
||||||
INSIST(!ISC_QLINK_LINKED(client, ilink));
|
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);
|
ns_query_free(client);
|
||||||
isc_mem_put(client->mctx, client->recvbuf, RECV_BUFFER_SIZE);
|
isc_mem_put(client->mctx, client->recvbuf, RECV_BUFFER_SIZE);
|
||||||
isc_event_free((isc_event_t **)&client->sendevent);
|
isc_event_free((isc_event_t **)&client->sendevent);
|
||||||
@@ -575,16 +586,6 @@ exit_check(ns_client_t *client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dns_message_destroy(&client->message);
|
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
|
* Detaching the task must be done after unlinking from
|
||||||
@@ -605,6 +606,13 @@ exit_check(ns_client_t *client) {
|
|||||||
isc_mem_stats(client->mctx, stderr);
|
isc_mem_stats(client->mctx, stderr);
|
||||||
INSIST(0);
|
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));
|
isc_mem_putanddetach(&client->mctx, client, sizeof(*client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -632,6 +632,10 @@ ns_query_init(ns_client_t *client) {
|
|||||||
client->query.timerset = ISC_FALSE;
|
client->query.timerset = ISC_FALSE;
|
||||||
client->query.rpz_st = NULL;
|
client->query.rpz_st = NULL;
|
||||||
client->query.qname = NULL;
|
client->query.qname = NULL;
|
||||||
|
/*
|
||||||
|
* This mutex is destroyed when the client is destroyed in
|
||||||
|
* exit_check().
|
||||||
|
*/
|
||||||
result = isc_mutex_init(&client->query.fetchlock);
|
result = isc_mutex_init(&client->query.fetchlock);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
@@ -652,8 +656,10 @@ ns_query_init(ns_client_t *client) {
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
result = query_newnamebuf(client);
|
result = query_newnamebuf(client);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS) {
|
||||||
query_freefreeversions(client, ISC_TRUE);
|
query_freefreeversions(client, ISC_TRUE);
|
||||||
|
DESTROYLOCK(&client->query.fetchlock);
|
||||||
|
}
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user