summaryrefslogtreecommitdiffstats
path: root/tools/power/x86
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2019-04-08 18:12:40 +0200
committerLen Brown <len.brown@intel.com>2019-08-31 20:48:34 +0200
commit605736c6929d541c78a85dffae4d33a23b6b2149 (patch)
tree17983d66f5769f1d588c772a9ad6e8ea02b8042e /tools/power/x86
parenttools/power turbostat: fix leak of file descriptor on error return path (diff)
downloadlinux-605736c6929d541c78a85dffae4d33a23b6b2149.tar.xz
linux-605736c6929d541c78a85dffae4d33a23b6b2149.zip
tools/power turbostat: fix file descriptor leaks
Fix file descriptor leaks by closing fp before return. Addresses-Coverity-ID: 1444591 ("Resource leak") Addresses-Coverity-ID: 1444592 ("Resource leak") Fixes: 5ea7647b333f ("tools/power turbostat: Warn on bad ACPI LPIT data") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power/x86')
-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 41cf1206273c..2fb5c155289b 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2918,6 +2918,7 @@ int snapshot_cpu_lpi_us(void)
if (retval != 1) {
fprintf(stderr, "Disabling Low Power Idle CPU output\n");
BIC_NOT_PRESENT(BIC_CPU_LPI);
+ fclose(fp);
return -1;
}