[zxsocket] close the channel
This fixes a handle leak in all Go programs that use the network. Tested
by running a test in a loop and observing handle counts using `k zx ps`;
before this change, the number of channel handles grew without bound -
after the change, the number of handles remained constant.
Change-Id: Ida10e9df5b5b6ac82383d3f651725f8fef39fbd9
diff --git a/src/syscall/zx/zxsocket/socket.go b/src/syscall/zx/zxsocket/socket.go
index 6a213aa..b662b15 100644
--- a/src/syscall/zx/zxsocket/socket.go
+++ b/src/syscall/zx/zxsocket/socket.go
@@ -75,6 +75,10 @@
return syscall.Errno(code)
}
+ if err := s.ControlInterface.Channel.Close(); err != nil {
+ return err
+ }
+
return s.socket.Close()
}