Skip to content

Commit

Permalink
vc: Persist file handle may leak in FS#FromDisk
Browse files Browse the repository at this point in the history
Fixes kata-containers#2233

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
  • Loading branch information
yutedz committed Nov 20, 2019
1 parent 1f71114 commit 2331e87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virtcontainers/persist/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2331e87

Please sign in to comment.