Fix File to Close

(This is a cherry-pick of 937ca107c3d22da77eb8e8030f2342253b980980.)

Signed-off-by: hang.jiang <hang.jiang@daocloud.io>
Fixes: GHSA-xr7r-f8xq-vfvv CVE-2024-21626
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
hang.jiang
2023-09-01 16:17:13 +08:00
committed by Aleksa Sarai
parent 099ff69336
commit 506552a88b
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -83,6 +83,7 @@ func tryDefaultCgroupRoot() string {
if err != nil {
return ""
}
defer dir.Close()
names, err := dir.Readdirnames(1)
if err != nil {
return ""
+1
View File
@@ -174,6 +174,7 @@ other options are ignored.
if err != nil {
return err
}
defer f.Close()
}
err = json.NewDecoder(f).Decode(&r)
if err != nil {