]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pm: cpupower: Fix cmd_monitor() error legs to free cpu_topology
authorShuah Khan <skhan@linuxfoundation.org>
Wed, 5 Mar 2025 22:53:39 +0000 (15:53 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 6 Mar 2025 20:27:38 +0000 (13:27 -0700)
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>
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c

index e123aa578881dec4ff0f565d3bfe89ace77a5a3d..0380d2e70016a7b94d43aa856594bef867083060 100644 (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);
        }