Merge pull request #272 from laijs/close-config-file

close config file after loaded
This commit is contained in:
Mrunal Patel 2015-09-16 11:34:12 -07:00
commit abb40ac3c7
1 changed files with 3 additions and 0 deletions

View File

@ -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
}