diff --git a/libcontainer/cgroups/fs/paths.go b/libcontainer/cgroups/fs/paths.go index c5d234acf1a..5f119bac31b 100644 --- a/libcontainer/cgroups/fs/paths.go +++ b/libcontainer/cgroups/fs/paths.go @@ -83,6 +83,7 @@ func tryDefaultCgroupRoot() string { if err != nil { return "" } + defer dir.Close() names, err := dir.Readdirnames(1) if err != nil { return "" diff --git a/update.go b/update.go index 425ce135397..e5de1a77f57 100644 --- a/update.go +++ b/update.go @@ -182,6 +182,7 @@ other options are ignored. if err != nil { return err } + defer f.Close() } err = json.NewDecoder(f).Decode(&r) if err != nil {