Skip to content

Commit

Permalink
tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num()
Browse files Browse the repository at this point in the history
[ Upstream commit f85450f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
samasth-norway authored and gregkh committed Apr 13, 2024
1 parent ec72568 commit cf21eb6
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -1241,6 +1241,7 @@ unsigned int get_pkg_num(int cpu)
retval = fscanf(fp, "%d\n", &pkg);
if (retval != 1)
errx(1, "%s: failed to parse", pathname);
fclose(fp);
return pkg;
}

Expand Down

0 comments on commit cf21eb6

Please sign in to comment.