Skip to content

Commit bf48ed3

Browse files
committed
metrics: fix file descriptor leak when reading disk stats on linux
The disk stats file was not closed after reading.
1 parent ba14957 commit bf48ed3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

metrics/disk_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func ReadDiskStats(stats *DiskStats) error {
3434
if err != nil {
3535
return err
3636
}
37+
defer inf.Close()
3738
in := bufio.NewReader(inf)
3839

3940
// Iterate over the IO counter, and extract what we need

0 commit comments

Comments
 (0)