Fix files not closed in mountinfo parsing function

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2015-07-27 19:33:39 -04:00
parent 6ee61aead2
commit 0e72bfb815
1 changed files with 4 additions and 0 deletions

View File

@ -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()