diff --git a/src/pkg/net/sock.go b/src/pkg/net/sock.go index 366e050ff3b..2359014ad63 100644 --- a/src/pkg/net/sock.go +++ b/src/pkg/net/sock.go @@ -52,6 +52,7 @@ func socket(net string, f, p, t int, la, ra syscall.Sockaddr, toAddr func(syscal if ra != nil { if err = fd.connect(ra); err != nil { + closesocket(s) fd.Close() return nil, err }