From 908ba8441182f34a7b565a692ebb60e8af321d17 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Tue, 22 Dec 2009 22:16:18 +0100
Subject: Fix duplicate port deallocation

	* proc/notify.c (do_mach_notify_dead_name): Do not call
	mach_port_deallocate on `deadport' on failure.
---
 proc/notify.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'proc')

diff --git a/proc/notify.c b/proc/notify.c
index 07fc376d..5a112b07 100644
--- a/proc/notify.c
+++ b/proc/notify.c
@@ -41,12 +41,10 @@ do_mach_notify_dead_name (mach_port_t notify,
 {
   struct proc *p;
 
-  /* Drop gratuitous extra reference that the notification creates. */
-  mach_port_deallocate (mach_task_self (), deadport);
-
   if (notify == generic_port)
     {
       check_dead_execdata_notify (deadport);
+      mach_port_deallocate (mach_task_self (), deadport);
       return 0;
     }
 
@@ -59,6 +57,7 @@ do_mach_notify_dead_name (mach_port_t notify,
     {
       process_has_exited (p);
       ports_port_deref (p);
+      mach_port_deallocate (mach_task_self (), deadport);
       return 0;
     }
   else
-- 
cgit v1.2.3