aboutsummaryrefslogtreecommitdiffstats
path: root/metrics/disk_linux.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-08-03 08:42:45 +0800
committerFelix Lange <fjl@twurst.com>2015-08-03 22:27:36 +0800
commitbf48ed32dd8be6bec2931c9f1eee4fd749affa21 (patch)
treec38b682e01a4c548990c9439ac08fd4c6bfd5acc /metrics/disk_linux.go
parentba14957cf3ce8415bd930310a0edd1fce76ddb22 (diff)
downloaddexon-bf48ed32dd8be6bec2931c9f1eee4fd749affa21.tar.gz
dexon-bf48ed32dd8be6bec2931c9f1eee4fd749affa21.tar.zst
dexon-bf48ed32dd8be6bec2931c9f1eee4fd749affa21.zip
metrics: fix file descriptor leak when reading disk stats on linux
The disk stats file was not closed after reading.
Diffstat (limited to 'metrics/disk_linux.go')
-rw-r--r--metrics/disk_linux.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/metrics/disk_linux.go b/metrics/disk_linux.go
index e0c8a1a3a..8967d490e 100644
--- a/metrics/disk_linux.go
+++ b/metrics/disk_linux.go
@@ -34,6 +34,7 @@ func ReadDiskStats(stats *DiskStats) error {
if err != nil {
return err
}
+ defer inf.Close()
in := bufio.NewReader(inf)
// Iterate over the IO counter, and extract what we need