summaryrefslogtreecommitdiff
path: root/libports
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2013-11-25 14:10:53 +0100
committerRichard Braun <rbraun@sceen.net>2013-11-26 01:32:34 +0100
commit2ef89abb8cbafab865baa2399e2641879b495aea (patch)
treed5c9153b7ea06371a562b29b4359922fe37f5852 /libports
parent5e3d2fc37be8b73a0ddabf1389c75f79e77c7e93 (diff)
libports: fix right leaks when adjusting priorities
* libports/manage-multithread.c (adjust_priority): Deallocate processor set rights before returning.
Diffstat (limited to 'libports')
-rw-r--r--libports/manage-multithread.c6
1 files changed, 5 insertions, 1 deletions
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)
{