Merge pull request #2234 from tedyu/close-cf

vc: Persist file handle may leak in FS#FromDisk
This commit is contained in:
Julio Montes 2019-11-21 09:38:29 -06:00 committed by GitHub
commit 3a4025fbf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,11 +201,11 @@ func (fs *FS) FromDisk(sid string) (persistapi.SandboxState, map[string]persista
return ss, nil, err
}
defer cf.Close()
var cstate persistapi.ContainerState
if err := json.NewDecoder(cf).Decode(&cstate); err != nil {
return ss, nil, err
}
cf.Close()
fs.containerState[cid] = cstate
}