]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tools/power turbostat: fix file descriptor leaks
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 8 Apr 2019 16:12:40 +0000 (11:12 -0500)
committerLen Brown <len.brown@intel.com>
Sat, 31 Aug 2019 18:48:34 +0000 (14:48 -0400)
Fix file descriptor leaks by closing fp before return.

Addresses-Coverity-ID: 1444591 ("Resource leak")
Addresses-Coverity-ID: 1444592 ("Resource leak")
Fixes: 462601838eac ("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>
tools/power/x86/turbostat/turbostat.c

index 41cf1206273c2cc6a5ca26241bbc201207b14721..2fb5c155289bcca54b8eb310aa2cbe83781feb44 100644 (file)
@@ -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;
        }