Merge pull request #21258 from runcom/res.body.leaks

*: fix response body leaks
This commit is contained in:
David Calavera 2016-03-16 19:20:10 -07:00
commit 8562b657c8

View file

@ -284,6 +284,7 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, imgSize int64) (io
res, err = r.client.Do(req)
if err != nil {
logrus.Debugf("Error contacting registry %s: %v", registry, err)
// the only case err != nil && res != nil is https://golang.org/src/net/http/client.go#L515
if res != nil {
if res.Body != nil {
res.Body.Close()