summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuah Khan <skhan@linuxfoundation.org>2025-03-05 15:53:39 -0700
committerShuah Khan <skhan@linuxfoundation.org>2025-03-06 13:27:38 -0700
commitd52d2b311a5a251ddd723d1dac881dc46e8803ab (patch)
treefc2ddfda18be77b9ab2a20b0bd46cbe9170629f8
parent80d3175a7e073fad281bdc5c7e881f46ab806d97 (diff)
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>
-rw-r--r--tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index e123aa578881..0380d2e70016 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -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);
}