Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b14a964

Browse files
committed
Do not leak fd when DialUDP succeeds but Write fails
1 parent d860d79 commit b14a964

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dnscrypt-proxy/netprobe_windows.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func NetProbe(proxy *Proxy, address string, timeout int) error {
3636
// set up yet. If this is the case Write fails with WSAENOBUFS: "An operation on a socket could not be
3737
// performed because the system lacked sufficient buffer space or because a queue was full"
3838
_, err = pc.Write([]byte{0})
39+
if err != nil {
40+
pc.Close()
41+
}
3942
}
4043
if err != nil {
4144
if !retried {

0 commit comments

Comments
 (0)