summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandra Ellwood <lxs@mit.edu>2008-08-22 16:44:22 +0000
committerAlexandra Ellwood <lxs@mit.edu>2008-08-22 16:44:22 +0000
commitfc539b7d38ff1dcf0f28fb76edf8bcdbbed99dea (patch)
tree1329765ab9b34cce48a594ca2f0490859d29f55d
parent853980601f2ab7553ac4b19f7faee872abe9a367 (diff)
downloadkrb5-fc539b7d38ff1dcf0f28fb76edf8bcdbbed99dea.tar.gz
krb5-fc539b7d38ff1dcf0f28fb76edf8bcdbbed99dea.tar.xz
krb5-fc539b7d38ff1dcf0f28fb76edf8bcdbbed99dea.zip
CCAPI is leaking mach ports
Need to destroy the mach ports instead of deallocating because we requested notifications on the port so just deallocating won't actually destroy the port. Also deallocate any port which was previously registered for notifications. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20688 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/ccapi/lib/mac/ccapi_os_ipc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ccapi/lib/mac/ccapi_os_ipc.c b/src/ccapi/lib/mac/ccapi_os_ipc.c
index f90562107..2fabb1922 100644
--- a/src/ccapi/lib/mac/ccapi_os_ipc.c
+++ b/src/ccapi/lib/mac/ccapi_os_ipc.c
@@ -240,7 +240,11 @@ cc_int32 cci_os_ipc (cc_int32 in_launch_server,
err = mach_port_request_notification (mach_task_self (), reply_port,
MACH_NOTIFY_NO_SENDERS, 1, reply_port,
MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &old_notification_target );
+ &old_notification_target);
+
+ if (!err && old_notification_target != MACH_PORT_NULL) {
+ mach_port_deallocate (mach_task_self (), old_notification_target);
+ }
}
if (!err) {
@@ -263,7 +267,7 @@ cc_int32 cci_os_ipc (cc_int32 in_launch_server,
pthread_setspecific (g_reply_stream_key, NULL);
pthread_setspecific (g_server_died_key, NULL);
- if (MACH_PORT_VALID (reply_port)) { mach_port_deallocate (mach_task_self (), reply_port); }
+ if (reply_port != MACH_PORT_NULL) { mach_port_destroy (mach_task_self (), reply_port); }
if (ool_request_length ) { vm_deallocate (mach_task_self (), (vm_address_t) ool_request, ool_request_length); }
if (reply_stream ) { cci_stream_release (reply_stream); }