[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a9e1ecb-2905-4318-8669-c515568e1d42@linuxfoundation.org>
Date: Tue, 16 Sep 2025 16:27:00 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: cryolitia@...ontech.com, Thomas Renninger <trenn@...e.com>,
Shuah Khan <shuah@...nel.org>, "John B. Wyatt IV" <jwyatt@...hat.com>,
John Kacur <jkacur@...hat.com>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
niecheng1@...ontech.com, zhanjun@...ontech.com,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] cpupower: fix memory leak in print_{on,off}line_cpus()
On 8/27/25 03:46, Cryolitia PukNgae via B4 Relay wrote:
> From: Cryolitia PukNgae <cryolitia@...ontech.com>
>
> {on,off}online_cpus_str not free after use
How did you find this problem? The memory is released when cpupower
exits - do you need this free?
>
> Suggested-by: Jun Zhan <zhanjun@...ontech.com>
> Signed-off-by: Cryolitia PukNgae <cryolitia@...ontech.com>
> ---
> tools/power/cpupower/utils/helpers/misc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c
> index 166dc1e470ea6d70079fea6570750885d549603a..f3b4fe95520ff96a1be8b1ba8e7be1ec116b1bc0 100644
> --- a/tools/power/cpupower/utils/helpers/misc.c
> +++ b/tools/power/cpupower/utils/helpers/misc.c
> @@ -213,6 +213,8 @@ void print_online_cpus(void)
> bitmask_displaylist(online_cpus_str, str_len, online_cpus);
> printf(_("Following CPUs are online:\n%s\n"), online_cpus_str);
> }
> +
> + free(online_cpus_str);
> }
>
> /* print_offline_cpus
> @@ -232,6 +234,8 @@ void print_offline_cpus(void)
> printf(_("Following CPUs are offline:\n%s\n"), offline_cpus_str);
> printf(_("cpupower set operation was not performed on them\n"));
> }
> +
> + free(offline_cpus_str);
> }
>
> /*
>
thanks,
-- Shuah
Powered by blists - more mailing lists