diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-03-03 23:48:30 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-03-03 23:48:30 +0100 |
commit | e06952fcf88f4af1277b8faaa2749bfcc7db73ba (patch) | |
tree | d124241c29851e49f1d178c24edbfd657ca58588 | |
parent | dbfa8a31e5e954d8309068e1bcc815a608e4b618 (diff) |
Deallocate thread ports on error
* proc/info.c (S_proc_getprocinfo): Deallocate ports obtained from
task_threads() call when an allocation error will be returned.
-rw-r--r-- | proc/info.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/proc/info.c b/proc/info.c index 445fcd8b..11625442 100644 --- a/proc/info.c +++ b/proc/info.c @@ -426,7 +426,11 @@ S_proc_getprocinfo (struct proc *callerp, { err = errno; if (*flags & PI_FETCH_THREADS) - munmap (thds, nthreads * sizeof (thread_t)); + { + for (i = 0; i < nthreads; i++) + mach_port_deallocate (mach_task_self (), thds[i]); + munmap (thds, nthreads * sizeof (thread_t)); + } return err; } pi_alloced = 1; |