Messages in this thread Patch in this message | | | From | Hao Zeng <> | Subject | [PATCH] cpupower:Fix resource leaks in sysfs_get_enabled() | Date | Thu, 13 Apr 2023 12:46:02 +0800 |
| |
The sysfs_get_enabled() opened file processor not closed, may cause a file handle leak.
Signed-off-by: Hao Zeng <zenghao@kylinos.cn> --- tools/power/cpupower/lib/powercap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/cpupower/lib/powercap.c b/tools/power/cpupower/lib/powercap.c index 0ce29ee4c2e4..a39ee1c89679 100644 --- a/tools/power/cpupower/lib/powercap.c +++ b/tools/power/cpupower/lib/powercap.c @@ -51,7 +51,7 @@ static int sysfs_get_enabled(char *path, int *mode) close(fd); return -1; } - + close(fd); if (yes_no == '1') { *mode = 1; return 0; -- 2.37.2
No virus found Checked by Hillstone Network AntiVirus
| |