mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
修复内存泄漏
This commit is contained in:
@@ -271,11 +271,7 @@ func (obj *Response) ReadBody() (err error) {
|
||||
return errors.New("already read body")
|
||||
}
|
||||
obj.readBody = true
|
||||
bBody := bufferPool.Get().(*bytes.Buffer)
|
||||
defer func() {
|
||||
bBody.Reset()
|
||||
bufferPool.Put(bBody)
|
||||
}()
|
||||
bBody := bytes.NewBuffer(nil)
|
||||
if obj.bar && obj.ContentLength() > 0 {
|
||||
_, err = io.Copy(&barBody{
|
||||
bar: bar.NewClient(obj.response.ContentLength),
|
||||
|
||||
Reference in New Issue
Block a user