mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
internal/socks: fix socket descriptor leakage in Dialer.Dial
Fixes golang/go#27630. Change-Id: Id44ade435733ffcd2fc8159ea9ea3287baadf97a Reviewed-on: https://go-review.googlesource.com/134755 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
@@ -224,6 +224,7 @@ func (d *Dialer) Dial(network, address string) (net.Conn, error) {
|
||||
return nil, &net.OpError{Op: d.cmd.String(), Net: network, Source: proxy, Addr: dst, Err: err}
|
||||
}
|
||||
if _, err := d.DialWithConn(context.Background(), c, network, address); err != nil {
|
||||
c.Close()
|
||||
return nil, err
|
||||
}
|
||||
return c, nil
|
||||
|
||||
Reference in New Issue
Block a user