Skip to content

Commit

Permalink
registry/session: fix panic in GetRemoteImageLayer
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <[email protected]> (github: unclejack)
  • Loading branch information
unclejack committed Sep 3, 2014
1 parent 58dc474 commit 9c413e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion registry/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9c413e3

Please sign in to comment.