mirror of
https://github.com/golang/go
synced 2024-11-17 13:54:46 -07:00
net/http: fix the potential leak of textproto.Reader from pool
Fixes #55835 Change-Id: I6109bab2941b859e8cfef22f65a6a3a5f977a8d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/433835 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
e978ef36e3
commit
d9d2ef991c
@ -1030,6 +1030,8 @@ func ReadRequest(b *bufio.Reader) (*Request, error) {
|
||||
|
||||
func readRequest(b *bufio.Reader) (req *Request, err error) {
|
||||
tp := newTextprotoReader(b)
|
||||
defer putTextprotoReader(tp)
|
||||
|
||||
req = new(Request)
|
||||
|
||||
// First line: GET /index.html HTTP/1.0
|
||||
@ -1038,7 +1040,6 @@ func readRequest(b *bufio.Reader) (req *Request, err error) {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
putTextprotoReader(tp)
|
||||
if err == io.EOF {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user