pm: cpupower: Fix cmd_monitor() error legs to free cpu_topology

cmd_monitor() calls get_cpu_topology() to allocate memory for
cpu topology and fails to release in error legs.

Fix it to call cpu_topology_release() from error legs.

Link: https://lore.kernel.org/r/20250305225342.19447-2-skhan@linuxfoundation.org
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Shuah Khan 2025-03-05 15:53:39 -07:00
parent 80d3175a7e
commit d52d2b311a
1 changed files with 2 additions and 0 deletions

View File

@ -427,11 +427,13 @@ int cmd_monitor(int argc, char **argv)
if (avail_monitors == 0) {
printf(_("No HW Cstate monitors found\n"));
cpu_topology_release(cpu_top);
return 1;
}
if (mode == list) {
list_monitors();
cpu_topology_release(cpu_top);
exit(EXIT_SUCCESS);
}