From bf48ed32dd8be6bec2931c9f1eee4fd749affa21 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 3 Aug 2015 02:42:45 +0200 Subject: metrics: fix file descriptor leak when reading disk stats on linux The disk stats file was not closed after reading. --- metrics/disk_linux.go | 1 + 1 file changed, 1 insertion(+) (limited to 'metrics/disk_linux.go') 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 -- cgit v1.2.3