Skip to content

Commit

Permalink
Fix: return pooled buffer when simple-obfs tls read error (#2643)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdbai authored Mar 26, 2023
1 parent 8f9b39c commit 7e2974f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion transport/simple-obfs/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7e2974f

Please sign in to comment.