[tor-commits] [goptlib/master] Close the Conn in case of error in AcceptSocks.
dcf at torproject.org
dcf at torproject.org
Wed Jun 24 06:28:12 UTC 2015
commit 88248f58a498c092454e953232713bf5f7be6c82
Author: David Fifield <david at bamsoftware.com>
Date: Tue Jun 23 23:27:19 2015 -0700
Close the Conn in case of error in AcceptSocks.
---
socks.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/socks.go b/socks.go
index 6ad6542..eba318b 100644
--- a/socks.go
+++ b/socks.go
@@ -136,6 +136,7 @@ func (ln *SocksListener) AcceptSocks() (*SocksConn, error) {
conn.Conn = c
err = conn.SetDeadline(time.Now().Add(socksRequestTimeout))
if err != nil {
+ conn.Close()
return nil, err
}
conn.Req, err = readSocks4aConnect(conn)
@@ -145,6 +146,7 @@ func (ln *SocksListener) AcceptSocks() (*SocksConn, error) {
}
err = conn.SetDeadline(time.Time{})
if err != nil {
+ conn.Close()
return nil, err
}
return conn, nil
More information about the tor-commits
mailing list