diff --git a/portfwd.go b/portfwd.go index 2c7d40683b..e2c22d42d1 100644 --- a/portfwd.go +++ b/portfwd.go @@ -72,10 +72,10 @@ func (cl *Client) clearPortMappings() { var wg sync.WaitGroup wg.Add(mLen) for _, m := range cl.upnpMappings { - go func() { + go func(m *upnpMapping) { defer wg.Done() cl.deletePortMapping(m.d, m.proto, m.externalPort) - }() + }(m) } cl.upnpMappings = nil }