mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-26 18:44:47 +01:00
vc: Persist file handle may leak in FS#ToDisk
Fixes #2241 Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user