Close HTTP client request body to prevent memory leaks.

This commit is contained in:
Adrian Gallagher
2015-03-14 16:03:05 +11:00
parent 2e13fae287
commit 6e6542001a
11 changed files with 14 additions and 14 deletions

View File

@@ -287,6 +287,7 @@ func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, values url.Values,
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
if err != nil {
return errors.New("PostRequest: Unable to send request")
@@ -304,6 +305,5 @@ func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, values url.Values,
return errors.New("Unable to JSON response.")
}
resp.Body.Close()
return nil
}