diff --git a/proxy/socks/socks.go b/proxy/socks/socks.go index 40c97e2a..933cb1bc 100644 --- a/proxy/socks/socks.go +++ b/proxy/socks/socks.go @@ -95,8 +95,10 @@ func (this *SocksServer) handleConnection(connection *hub.TCPConn) { timedReader := v2net.NewTimeOutReader(120, connection) reader := v2io.NewBufferedReader(timedReader) + defer reader.Release() writer := v2io.NewBufferedWriter(connection) + defer writer.Release() auth, auth4, err := protocol.ReadAuthentication(reader) if err != nil && err != protocol.Socks4Downgrade { diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index c9f6abc0..c0e92b44 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -90,6 +90,7 @@ func (this *VMessOutboundHandler) handleRequest(session *raw.ClientSession, conn defer finish.Unlock() writer := v2io.NewBufferedWriter(conn) + defer writer.Release() session.EncodeRequestHeader(request, writer) // Send first packet of payload together with request, in favor of small requests. @@ -131,6 +132,7 @@ func (this *VMessOutboundHandler) handleResponse(session *raw.ClientSession, con defer close(output) reader := v2io.NewBufferedReader(conn) + defer reader.Release() header, err := session.DecodeResponseHeader(reader) if err != nil {