From 7e2974f02ffa31f577d4e4949388d967a111aa1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=85=E5=B8=83=E4=B8=81?= Date: Sun, 26 Mar 2023 16:22:23 +0800 Subject: [PATCH] Fix: return pooled buffer when simple-obfs tls read error (#2643) --- transport/simple-obfs/tls.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transport/simple-obfs/tls.go b/transport/simple-obfs/tls.go index 0c40303..1d84fbf 100644 --- a/transport/simple-obfs/tls.go +++ b/transport/simple-obfs/tls.go @@ -27,10 +27,10 @@ type TLSObfs struct { func (to *TLSObfs) read(b []byte, discardN int) (int, error) { buf := pool.Get(discardN) _, err := io.ReadFull(to.Conn, buf) + pool.Put(buf) if err != nil { return 0, err } - pool.Put(buf) sizeBuf := make([]byte, 2) _, err = io.ReadFull(to.Conn, sizeBuf)