2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Add missing isc_mutex_destroy and isc_conditional_destroy calls.

While harmless on Linux, missing isc_{mutex,conditional}_destroy
causes a memory leak on *BSD. Missing calls were added.
This commit is contained in:
Witold Kręcicki
2020-05-28 12:34:37 +02:00
committed by Ondřej Surý
parent 146748f5c6
commit a8807d9a7b
3 changed files with 9 additions and 0 deletions

View File

@@ -10086,6 +10086,7 @@ named_server_destroy(named_server_t **serverp) {
dst_lib_destroy();
isc_event_free(&server->reload_event);
isc_mutex_destroy(&server->reload_event_lock);
INSIST(ISC_LIST_EMPTY(server->kasplist));
INSIST(ISC_LIST_EMPTY(server->viewlist));

View File

@@ -276,6 +276,9 @@ nm_destroy(isc_nm_t **mgr0) {
isc_queue_destroy(worker->ievents);
isc_queue_destroy(worker->ievents_prio);
isc_mutex_destroy(&worker->lock);
isc_condition_destroy(&worker->cond);
isc_mem_put(mgr->mctx, worker->recvbuf,
ISC_NETMGR_RECVBUF_SIZE);
isc_thread_join(worker->thread, NULL);
@@ -771,6 +774,8 @@ nmsocket_cleanup(isc_nmsocket_t *sock, bool dofree) {
isc_mem_free(sock->mgr->mctx, sock->ah_frees);
isc_mem_free(sock->mgr->mctx, sock->ah_handles);
isc_mutex_destroy(&sock->lock);
isc_condition_destroy(&sock->cond);
if (dofree) {
isc_nm_t *mgr = sock->mgr;

View File

@@ -1356,9 +1356,12 @@ static void
manager_free(isc__taskmgr_t *manager) {
for (unsigned int i = 0; i < manager->workers; i++) {
isc_mutex_destroy(&manager->queues[i].lock);
isc_condition_destroy(&manager->queues[i].work_available);
}
isc_mutex_destroy(&manager->lock);
isc_mutex_destroy(&manager->excl_lock);
isc_mutex_destroy(&manager->halt_lock);
isc_condition_destroy(&manager->halt_cond);
isc_mem_put(manager->mctx, manager->queues,
manager->workers * sizeof(isc__taskqueue_t));
manager->common.impmagic = 0;