From 0e72bfb815d449446e86699916fb48061a52314b Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Mon, 27 Jul 2015 19:33:39 -0400 Subject: [PATCH] Fix files not closed in mountinfo parsing function Signed-off-by: Mrunal Patel --- libcontainer/cgroups/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcontainer/cgroups/utils.go b/libcontainer/cgroups/utils.go index 92438a07..1d0cb502 100644 --- a/libcontainer/cgroups/utils.go +++ b/libcontainer/cgroups/utils.go @@ -25,6 +25,8 @@ func FindCgroupMountpoint(subsystem string) (string, error) { if err != nil { return "", err } + defer f.Close() + scanner := bufio.NewScanner(f) for scanner.Scan() { txt := scanner.Text() @@ -47,6 +49,8 @@ func FindCgroupMountpointAndSource(subsystem string) (string, string, error) { if err != nil { return "", "", err } + defer f.Close() + scanner := bufio.NewScanner(f) for scanner.Scan() { txt := scanner.Text()