Commit 15423b95 authored by Colin Ian King's avatar Colin Ian King Committed by Len Brown

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: 5ea7647b ("tools/power turbostat: Warn on bad ACPI LPIT data")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent d4794f25
...@@ -2944,6 +2944,7 @@ int snapshot_sys_lpi_us(void) ...@@ -2944,6 +2944,7 @@ int snapshot_sys_lpi_us(void)
if (retval != 1) { if (retval != 1) {
fprintf(stderr, "Disabling Low Power Idle System output\n"); fprintf(stderr, "Disabling Low Power Idle System output\n");
BIC_NOT_PRESENT(BIC_SYS_LPI); BIC_NOT_PRESENT(BIC_SYS_LPI);
fclose(fp);
return -1; return -1;
} }
fclose(fp); fclose(fp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment