Fix memory leak
Close resp.Body in the main Fetch function. When the resp.Body is not closed, it will keep all HTTP responses in memory and that amount will grow, quite fast.
This commit is contained in:
parent
e79b883faa
commit
67fd816e3f
|
@ -510,6 +510,7 @@ func Fetch2(fetchURL string) (*http.Response, error) {
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("error while fetching %s: %s", u, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
var b bytes.Buffer
|
||||
resp.Write(&b)
|
||||
|
|
Loading…
Reference in New Issue
Block a user