From e149b892631abc13276c5d92cff77fa8f65cab9e Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 20 Dec 2022 10:04:06 +0100 Subject: [PATCH] cmd/root: Don't leak the subordinate ID file Fallout from 3f0a135937dcbcaabcef69c1f9e6ed48d9ae78dc https://github.com/containers/toolbox/pull/1202 --- src/cmd/root.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd/root.go b/src/cmd/root.go index d1a2871..ac89a38 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -404,6 +404,8 @@ func validateSubIDFile(path string) (bool, error) { return false, fmt.Errorf("failed to open: %w", err) } + defer file.Close() + scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines)