[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 48/98: libports: another right leak fix
From: |
Samuel Thibault |
Subject: |
[hurd] 48/98: libports: another right leak fix |
Date: |
Tue, 14 Jan 2014 02:00:01 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit e5bb7f10e01224d75e55da6e545f779ac0fa73a3
Author: Richard Braun <address@hidden>
Date: Sat Nov 30 17:20:12 2013 +0100
libports: another right leak fix
* libports/manage-multithread.c (adjust_priority): Deallocate host
right before returning.
---
libports/manage-multithread.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
index be08030..dcebd09 100644
--- a/libports/manage-multithread.c
+++ b/libports/manage-multithread.c
@@ -53,36 +53,43 @@ adjust_priority (unsigned int totalthreads)
t = 10 + (((totalthreads - 1) / 100) + 1) * 10;
thread_switch (MACH_PORT_NULL, SWITCH_OPTION_DEPRESS, t);
- self = pset = pset_priv = MACH_PORT_NULL;
-
err = get_privileged_ports (&host_priv, NULL);
if (err)
- goto out;
+ goto error_host_priv;
self = mach_thread_self ();
err = thread_get_assignment (self, &pset);
if (err)
- goto out;
+ goto error_pset;
err = host_processor_set_priv (host_priv, pset, &pset_priv);
if (err)
- goto out;
+ goto error_pset_priv;
err = thread_max_priority (self, pset_priv, 0);
if (err)
- goto out;
+ goto error_max_priority;
err = thread_priority (self, THREAD_PRI, 0);
-
-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)
+ if (err)
+ goto error_priority;
+
+ mach_port_deallocate (mach_task_self (), pset_priv);
+ mach_port_deallocate (mach_task_self (), pset);
+ mach_port_deallocate (mach_task_self (), self);
+ mach_port_deallocate (mach_task_self (), host_priv);
+ return;
+
+error_priority:
+error_max_priority:
+ mach_port_deallocate (mach_task_self (), pset_priv);
+error_pset_priv:
+ mach_port_deallocate (mach_task_self (), pset);
+error_pset:
+ mach_port_deallocate (mach_task_self (), self);
+ mach_port_deallocate (mach_task_self (), host_priv);
+error_host_priv:
+ if (err != EPERM)
error (0, err, "unable to adjust libports thread priority");
}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 66/98: trans: improve the performance of dir_lookup in fakeroot, (continued)
- [hurd] 66/98: trans: improve the performance of dir_lookup in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 41/98: libports: improve error handling in ports_reallocate_from_external, Samuel Thibault, 2014/01/13
- [hurd] 40/98: libports: improve error handling in ports_reallocate_port, Samuel Thibault, 2014/01/13
- [hurd] 58/98: trans: remove unused declaration from fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 72/98: trans: fix reference counting bug in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 39/98: proc: update comments, Samuel Thibault, 2014/01/13
- [hurd] 26/98: Make sure created netfs nodes have stat validated, Samuel Thibault, 2014/01/13
- [hurd] 53/98: proc: improve the message_demuxer function, Samuel Thibault, 2014/01/13
- [hurd] 04/98: utils: implement settrans --pid-file, Samuel Thibault, 2014/01/13
- [hurd] 59/98: trans: improve the netfs_demuxer function in fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 48/98: libports: another right leak fix,
Samuel Thibault <=
- [hurd] 73/98: trans: improve the error handling in fakeauth, Samuel Thibault, 2014/01/13
- [hurd] 06/98: proc: fix the declaraton of genpid, Samuel Thibault, 2014/01/13
- [hurd] 71/98: trans: fix locking in fakeroot's netfs_S_dir_lookup, Samuel Thibault, 2014/01/13
- [hurd] 70/98: trans: fix reference counting and destruction of fake nodes, Samuel Thibault, 2014/01/13
- [hurd] 77/98: trans/fakeroot: fix ownership of newly created files, Samuel Thibault, 2014/01/13
- [hurd] 64/98: libihash: remove dead code, Samuel Thibault, 2014/01/13
- [hurd] 74/98: trans: unlock nodes with faked attributes in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 75/98: console-client: remove spurious pthread_spin_unlocks, Samuel Thibault, 2014/01/13
- [hurd] 62/98: trans: make the fakeroot environment more transparent, Samuel Thibault, 2014/01/13
- [hurd] 14/98: proc: turn count_up and store_pid into normal functions, Samuel Thibault, 2014/01/13