fix(trojan): potential memory leaking

This commit is contained in:
mzz2017 2021-11-18 11:23:22 +08:00
parent ce85f15c4b
commit bc7f614e02

View File

@ -84,6 +84,7 @@ func (s *Trojan) Serve(c net.Conn) {
if s.withTLS { if s.withTLS {
tlsConn := tls.Server(c, s.tlsConfig) tlsConn := tls.Server(c, s.tlsConfig)
defer tlsConn.Close()
err := tlsConn.Handshake() err := tlsConn.Handshake()
if err != nil { if err != nil {
log.F("[trojan] error in tls handshake: %s", err) log.F("[trojan] error in tls handshake: %s", err)