[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6546a78d-9989-417f-925c-c6422c28f2f2@linuxfoundation.org>
Date: Fri, 22 Nov 2024 11:02:37 -0700
From: Shuah Khan <skhan@...uxfoundation.org>
To: liujing <liujing@...s.chinamobile.com>, trenn@...e.com, shuah@...nel.org,
jwyatt@...hat.com, jkacur@...hat.com
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] cpupower: Fixing memory leaks
On 11/21/24 06:32, liujing wrote:
> If execlp fails, page memory is not freed, so fix it.
How did you find the problem?
>
> Signed-off-by: liujing <liujing@...s.chinamobile.com>
>
> diff --git a/tools/power/cpupower/utils/cpupower.c b/tools/power/cpupower/utils/cpupower.c
> index 9ec973165af1..36d486199630 100644
> --- a/tools/power/cpupower/utils/cpupower.c
> +++ b/tools/power/cpupower/utils/cpupower.c
> @@ -98,7 +98,7 @@ static int print_man_page(const char *subpage)
> }
>
> execlp("man", "man", page, NULL);
> -
> + free(page);
The memory gets free'ed when process exits. Why do you need this?
> /* should not be reached */
> return -EINVAL;
> }
thanks,
-- Shuah
Powered by blists - more mailing lists