]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tools/power turbostat: fix leak of file descriptor on error return path
authorColin Ian King <colin.king@canonical.com>
Mon, 8 Apr 2019 09:00:44 +0000 (10:00 +0100)
committerLen Brown <len.brown@intel.com>
Sat, 31 Aug 2019 18:48:34 +0000 (14:48 -0400)
Currently the error return path does not close the file fp and leaks
a file descriptor. Fix this by closing the file.

Fixes: 462601838eac ("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>
tools/power/x86/turbostat/turbostat.c

index 02813a2a8ffd86dffb92a13e2680c717176ca0dc..41cf1206273c2cc6a5ca26241bbc201207b14721 100644 (file)
@@ -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);