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:
parent
48096dad19
commit
2c78019539
1 changed files with 3 additions and 1 deletions
|
@ -167,7 +167,9 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, token []string, im
|
||||||
for i := 1; i <= retries; i++ {
|
for i := 1; i <= retries; i++ {
|
||||||
res, client, err = r.doRequest(req)
|
res, client, err = r.doRequest(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if res.Body != nil {
|
||||||
res.Body.Close()
|
res.Body.Close()
|
||||||
|
}
|
||||||
if i == retries {
|
if i == retries {
|
||||||
return nil, fmt.Errorf("Server error: Status %d while fetching image layer (%s)",
|
return nil, fmt.Errorf("Server error: Status %d while fetching image layer (%s)",
|
||||||
res.StatusCode, imgID)
|
res.StatusCode, imgID)
|
||||||
|
|
Loading…
Reference in a new issue