diff --git a/forwardproxy.go b/forwardproxy.go index 32235af..5fb26fb 100644 --- a/forwardproxy.go +++ b/forwardproxy.go @@ -579,6 +579,7 @@ func dualStream(target net.Conn, clientReader io.ReadCloser, clientWriter io.Wri buf := bufferPool.Get().([]byte) buf = buf[0:cap(buf)] _, _err := flushingIoCopy(w, r, buf) + bufferPool.Put(buf) if cw, ok := w.(closeWriter); ok { cw.CloseWrite() } @@ -642,6 +643,7 @@ func forwardResponse(w http.ResponseWriter, response *http.Response) error { buf := bufferPool.Get().([]byte) buf = buf[0:cap(buf)] _, err := io.CopyBuffer(w, response.Body, buf) + bufferPool.Put(buf) return err }