1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

registry/session: fix panic in GetRemoteImageLayer

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
unclejack 2014-09-03 17:26:56 +03:00
parent 58dc474e65
commit 9c413e3e6f

View file

@ -167,7 +167,9 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, token []string, im
for i := 1; i <= retries; i++ {
res, client, err = r.doRequest(req)
if err != nil {
res.Body.Close()
if res.Body != nil {
res.Body.Close()
}
if i == retries {
return nil, fmt.Errorf("Server error: Status %d while fetching image layer (%s)",
res.StatusCode, imgID)