From 6be011a74d39563c81418fd4c330a72e156cdeb8 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Thu, 23 Oct 2008 17:50:43 +0000 Subject: [PATCH] Free global mach ports on library unload ticket: 6248 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20911 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/mac/k5_mig_client.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/util/mac/k5_mig_client.c b/src/util/mac/k5_mig_client.c index 7d57468bb..7dedbbebb 100644 --- a/src/util/mac/k5_mig_client.c +++ b/src/util/mac/k5_mig_client.c @@ -144,14 +144,14 @@ MAKE_FINI_FUNCTION(k5_cli_ipc_thread_fini); static int k5_cli_ipc_thread_init (void) { int err = 0; - + err = k5_key_register (K5_KEY_IPC_CONNECTION_INFO, k5_ipc_client_cinfo_free); if (!err) { err = k5_mutex_finish_init (&g_service_ports_mutex); } - + return err; } @@ -159,6 +159,23 @@ static int k5_cli_ipc_thread_init (void) static void k5_cli_ipc_thread_fini (void) { + int err = 0; + + err = k5_mutex_lock (&g_service_ports_mutex); + + if (!err) { + int i; + + for (i = 0; i < KIPC_SERVICE_COUNT; i++) { + if (MACH_PORT_VALID (g_service_ports[i].service_port)) { + mach_port_destroy (mach_task_self (), + g_service_ports[i].service_port); + g_service_ports[i].service_port = MACH_PORT_NULL; + } + } + k5_mutex_unlock (&g_service_ports_mutex); + } + k5_key_delete (K5_KEY_IPC_CONNECTION_INFO); k5_mutex_destroy (&g_service_ports_mutex); } -- 2.26.2