vc: Persist file handle may leak in FS#FromDisk

Fixes #2233

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
Ted Yu 2019-11-20 11:48:34 -08:00
parent 1f71114291
commit 2331e879af

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
}