From eb0f24c6c48ea5301c5136b53333e189d0dc4c58 Mon Sep 17 00:00:00 2001 From: Ghanan Gowripalan Date: Fri, 13 Aug 2021 07:39:19 -0700 Subject: 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 --- pkg/tcpip/transport/udp/endpoint.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg/tcpip') diff --git a/pkg/tcpip/transport/udp/endpoint.go b/pkg/tcpip/transport/udp/endpoint.go index 82a3f2287..108580508 100644 --- a/pkg/tcpip/transport/udp/endpoint.go +++ b/pkg/tcpip/transport/udp/endpoint.go @@ -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() -- cgit v1.2.3