Skip to content

Commit 8d1369b

Browse files
authored
server: fix leaked net.Conn (#4642)
This happens when NewServerTransport() returns nil, nil. The rawConn is closed when the transport is closed, which will never happen in this case (since the returned transport is nil).
1 parent 2e0b66b commit 8d1369b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ func (s *Server) handleRawConn(lisAddr string, rawConn net.Conn) {
863863
// Finish handshaking (HTTP2)
864864
st := s.newHTTP2Transport(conn, authInfo)
865865
if st == nil {
866+
conn.Close()
866867
return
867868
}
868869

0 commit comments

Comments
 (0)