Skip to content

Commit 2f23fed

Browse files
committed
fix: file leak in reading cgroups
Ensure to close the file. This bug is only in `main` I believe. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent b412ffd commit 2f23fed

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

internal/pkg/cgroups/reader.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ func ReadCgroupfsProperty(node *Node, cgroupPath, property string) error {
1717
return fmt.Errorf("error opening cgroupfs file %w", err)
1818
}
1919

20+
defer f.Close() //nolint:errcheck
21+
2022
err = node.Parse(property, f)
2123
if err != nil {
2224
return fmt.Errorf("error parsing cgroupfs file %w", err)

0 commit comments

Comments
 (0)