mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: liujing <liujing@cmss.chinamobile.com>,
	trenn@suse.com, shuah@kernel.org, jwyatt@redhat.com,
	jkacur@redhat.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] cpupower: Fixing memory leaks
Date: Fri, 22 Nov 2024 11:02:37 -0700	[thread overview]
Message-ID: <6546a78d-9989-417f-925c-c6422c28f2f2@linuxfoundation.org> (raw)
In-Reply-To: <20241121133212.6809-1-liujing@cmss.chinamobile.com>

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@cmss.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

      reply	other threads:[~2024-11-22 18:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-21 13:32 liujing
2024-11-22 18:02 ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6546a78d-9989-417f-925c-c6422c28f2f2@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=liujing@cmss.chinamobile.com \
    --cc=shuah@kernel.org \
    --cc=trenn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®