Skip to content

Commit f85450f

Browse files
samasth-norwayrafaeljw
authored andcommitted
tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num()
In function get_pkg_num() if fopen_or_die() succeeds it returns a file pointer to be used. But fclose() is never called before returning from the function. Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent b401b62 commit f85450f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@ unsigned int get_pkg_num(int cpu)
12411241
retval = fscanf(fp, "%d\n", &pkg);
12421242
if (retval != 1)
12431243
errx(1, "%s: failed to parse", pathname);
1244+
fclose(fp);
12441245
return pkg;
12451246
}
12461247

0 commit comments

Comments
 (0)