commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 36/98: libports: fix right leaks when adjusting priorities


From: Samuel Thibault
Subject: [hurd] 36/98: libports: fix right leaks when adjusting priorities
Date: Tue, 14 Jan 2014 02:00:00 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 2ef89abb8cbafab865baa2399e2641879b495aea
Author: Richard Braun <address@hidden>
Date:   Mon Nov 25 14:10:53 2013 +0100

    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(-)

diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
index 842665a..d034582 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)
     {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]