From e06952fcf88f4af1277b8faaa2749bfcc7db73ba Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 3 Mar 2011 23:48:30 +0100 Subject: 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. --- proc/info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3