summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exec/exec.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/exec/exec.c b/exec/exec.c
index 202f708f..f18d5532 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1315,7 +1315,6 @@ do_exec (file_t file,
uid_t euidbuf[10], egidbuf[10], auidbuf[10], agidbuf[10];
uid_t *euids, *egids, *auids, *agids;
size_t neuids, negids, nauids, nagids;
- uid_t uid;
e.error = proc_task2proc (procserver, newtask, &new);
if (e.error)
@@ -1333,10 +1332,25 @@ do_exec (file_t file,
&egids, &negids, &agids, &nagids);
if (e.error)
goto stdout;
-
+
/* Set the owner with the proc server */
e.error = proc_setowner (boot->portarray[INIT_PORT_PROC],
neuids ? euids[0] : 0, !neuids);
+
+ /* Clean up */
+ if (euids != euidbuf)
+ vm_deallocate (mach_task_self (), (vm_address_t) euids,
+ neuids * sizeof (uid_t));
+ if (egids != egidbuf)
+ vm_deallocate (mach_task_self (), (vm_address_t) egids,
+ negids * sizeof (uid_t));
+ if (auids != auidbuf)
+ vm_deallocate (mach_task_self (), (vm_address_t) auids,
+ nauids * sizeof (uid_t));
+ if (agids != agidbuf)
+ vm_deallocate (mach_task_self (), (vm_address_t) agids,
+ nagids * sizeof (uid_t));
+
if (e.error)
goto stdout;
}