Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
vc: Persist file handle may leak in FS#ToDisk
Browse files Browse the repository at this point in the history
Fixes #2241

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
  • Loading branch information
yutedz committed Nov 21, 2019
1 parent a17ca14 commit b8b6733
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 @@ -139,10 +139,10 @@ func (fs *FS) ToDisk(ss persistapi.SandboxState, cs map[string]persistapi.Contai
return err
}

defer cf.Close()
if err := json.NewEncoder(cf).Encode(cstate); err != nil {
return err
}
cf.Close()
}

return nil
Expand Down

0 comments on commit b8b6733

Please sign in to comment.