summaryrefslogtreecommitdiff
path: root/debian/patches/pflocal-port-leak.patch
blob: 7b9f8c86f55d42f8c5a516a567fe1a5fa80dd9fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
2008-07-22  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* pf.c (S_socket_fabricate_address): Drop one reference from addr since
	we only take the send right.
	* socket.c (S_socket_name): Likewise.

Index: pflocal/pf.c
===================================================================
RCS file: /cvsroot/hurd/hurd/pflocal/pf.c,v
retrieving revision 1.15
diff -u -p -r1.15 pf.c
--- pflocal/pf.c	9 Aug 2000 21:13:53 -0000	1.15
+++ pflocal/pf.c	22 Jul 2008 00:54:47 -0000
@@ -108,6 +108,7 @@ S_socket_fabricate_address (mach_port_t 
 
   *addr_port = ports_get_right (addr);
   *addr_port_type = MACH_MSG_TYPE_MAKE_SEND;
+  ports_port_deref (addr);
 
   return 0;
 }
Index: pflocal/socket.c
===================================================================
RCS file: /cvsroot/hurd/hurd/pflocal/socket.c,v
retrieving revision 1.24
diff -u -p -r1.24 socket.c
--- pflocal/socket.c	29 Aug 2005 09:41:21 -0000	1.24
+++ pflocal/socket.c	22 Jul 2008 00:54:47 -0000
@@ -245,6 +245,7 @@ S_socket_name (struct sock_user *user,
 
   *addr_port = ports_get_right (addr);
   *addr_port_type = MACH_MSG_TYPE_MAKE_SEND;
+  ports_port_deref (addr);
 
   return 0;
 }
@@ -323,7 +324,10 @@ S_socket_send (struct sock_user *user, s
 			   source_addr, data, data_len,
 			   control, control_len, ports, num_ports,
 			   amount);
-	  pipe_release_writer (pipe);
+	  if (dest_sock)
+	    pipe_release_reader (pipe);
+	  else
+	    pipe_release_writer (pipe);
 	}
 
       if (err)