summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--proc/mgt.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/proc/mgt.c b/proc/mgt.c
index c4b8d0e3..37d4e43a 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -606,15 +606,20 @@ add_tasks (task_t task)
processor_set_tasks (psetpriv, &tasks, &ntasks);
for (j = 0; j < ntasks; j++)
{
+ int set = 0;
if (!foundp)
{
struct proc *p = task_find_nocreate (tasks[j]);
if (!p)
- p = new_proc (tasks[j]);
+ {
+ p = new_proc (tasks[j]);
+ set = 1;
+ }
if (!foundp && tasks[j] == task)
foundp = p;
}
- mach_port_deallocate (mach_task_self (), tasks[j]);
+ if (!set)
+ mach_port_deallocate (mach_task_self (), tasks[j]);
}
vm_deallocate (mach_task_self (), (vm_address_t) tasks,
ntasks * sizeof (task_t));