mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
close config file after loaded
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
@@ -282,6 +282,8 @@ func loadSpec(cPath, rPath string) (spec *specs.LinuxSpec, rspec *specs.LinuxRun
|
||||
}
|
||||
return
|
||||
}
|
||||
defer cf.Close()
|
||||
|
||||
rf, err := os.Open(rPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@@ -290,6 +292,7 @@ func loadSpec(cPath, rPath string) (spec *specs.LinuxSpec, rspec *specs.LinuxRun
|
||||
return
|
||||
}
|
||||
defer rf.Close()
|
||||
|
||||
if err = json.NewDecoder(cf).Decode(&spec); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user