Free multicastMemberships on UDP endpoint close

tcpip.Endpoint.Close is documented to free all resources associated
with an endpoint so we don't need to create an empty map to clear
the multicast memberships.

PiperOrigin-RevId: 390609826
This commit is contained in:
Ghanan Gowripalan
2021-08-13 07:42:22 -07:00
committed by gVisor bot
parent ddcf884e9d
commit eb0f24c6c4
+1 -1
View File
@@ -266,7 +266,7 @@ func (e *endpoint) Close() {
for mem := range e.multicastMemberships {
e.stack.LeaveGroup(e.NetProto, mem.nicID, mem.multicastAddr)
}
e.multicastMemberships = make(map[multicastMembership]struct{})
e.multicastMemberships = nil
// Close the receive list and drain it.
e.rcvMu.Lock()