From 2ef89abb8cbafab865baa2399e2641879b495aea Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Mon, 25 Nov 2013 14:10:53 +0100 Subject: libports: fix right leaks when adjusting priorities * libports/manage-multithread.c (adjust_priority): Deallocate processor set rights before returning. --- libports/manage-multithread.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libports') diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c index 842665a5..d0345826 100644 --- a/libports/manage-multithread.c +++ b/libports/manage-multithread.c @@ -52,7 +52,7 @@ adjust_priority (unsigned int totalthreads) t = 10 + (((totalthreads - 1) / 100) + 1) * 10; thread_switch (MACH_PORT_NULL, SWITCH_OPTION_DEPRESS, t); - self = MACH_PORT_NULL; + self = pset = pset_priv = MACH_PORT_NULL; err = get_privileged_ports (&host_priv, NULL); if (err) @@ -76,6 +76,10 @@ adjust_priority (unsigned int totalthreads) out: if (self != MACH_PORT_NULL) mach_port_deallocate (mach_task_self (), self); + if (pset != MACH_PORT_NULL) + mach_port_deallocate (mach_task_self (), pset); + if (pset_priv != MACH_PORT_NULL) + mach_port_deallocate (mach_task_self (), pset_priv); if (err && err != EPERM) { -- cgit v1.2.3