summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-04-08 12:00:44 +0300
committerLen Brown <len.brown@intel.com>2019-08-31 21:48:34 +0300
commit15423b958f33132152e209e98df0dedc7a78f22c (patch)
tree5ad0d282d9b81d88095b1c690313210da5436d8a /tools
parentd4794f25f122aa1a8a073be51112edaa723ffff4 (diff)
downloadlinux-15423b958f33132152e209e98df0dedc7a78f22c.tar.xz
tools/power turbostat: fix leak of file descriptor on error return path
Currently the error return path does not close the file fp and leaks a file descriptor. Fix this by closing the file. Fixes: 5ea7647b333f ("tools/power turbostat: Warn on bad ACPI LPIT data") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/power/x86/turbostat/turbostat.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 02813a2a8ffd..41cf1206273c 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2944,6 +2944,7 @@ int snapshot_sys_lpi_us(void)
if (retval != 1) {
fprintf(stderr, "Disabling Low Power Idle System output\n");
BIC_NOT_PRESENT(BIC_SYS_LPI);
+ fclose(fp);
return -1;
}
fclose(fp);