From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Prarit Bhargava <prarit@redhat.com>, platform-driver-x86@vger.kernel.org
Cc: andriy.shevchenko@intel.com, David Arcari <darcari@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 9/9] tools/power/x86/intel-speed-select: Fix memory leak
Date: Thu, 05 Sep 2019 12:42:05 -0700 [thread overview]
Message-ID: <f12560e59427ce7e038334a3b59bf084a748d998.camel@linux.intel.com> (raw)
In-Reply-To: <20190905120311.15286-10-prarit@redhat.com>
On Thu, 2019-09-05 at 08:03 -0400, Prarit Bhargava wrote:
> cpumasks are allocated by calling the alloc_cpu_mask() function and
> are
> never free'd. They should be free'd after the commands have run.
>
> Fix the memory leaks by calling free_cpu_set().
Good to fix this. But after one command execution the process will
exit.
Thanks,
Srinivas
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: David Arcari <darcari@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> ---
> tools/power/x86/intel-speed-select/isst-config.c | 16 +++++++++++---
> --
> 1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/tools/power/x86/intel-speed-select/isst-config.c
> b/tools/power/x86/intel-speed-select/isst-config.c
> index 78f0cebda1da..59753b3917bb 100644
> --- a/tools/power/x86/intel-speed-select/isst-config.c
> +++ b/tools/power/x86/intel-speed-select/isst-config.c
> @@ -603,6 +603,10 @@ static int isst_fill_platform_info(void)
>
> close(fd);
>
> + if (isst_platform_info.api_version > supported_api_ver) {
> + printf("Incompatible API versions; Upgrade of tool is
> required\n");
> + return -1;
> + }
> return 0;
> }
>
> @@ -1528,6 +1532,7 @@ static void cmdline(int argc, char **argv)
> {
> int opt;
> int option_index = 0;
> + int ret;
>
> static struct option long_options[] = {
> { "cpu", required_argument, 0, 'c' },
> @@ -1589,13 +1594,14 @@ static void cmdline(int argc, char **argv)
> set_max_cpu_num();
> set_cpu_present_cpu_mask();
> set_cpu_target_cpu_mask();
> - isst_fill_platform_info();
> - if (isst_platform_info.api_version > supported_api_ver) {
> - printf("Incompatible API versions; Upgrade of tool is
> required\n");
> - exit(0);
> - }
> + ret = isst_fill_platform_info();
> + if (ret)
> + goto out;
>
> process_command(argc, argv);
> +out:
> + free_cpu_set(present_cpumask);
> + free_cpu_set(target_cpumask);
> }
>
> int main(int argc, char **argv)
next prev parent reply other threads:[~2019-09-05 19:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 12:03 [PATCH v2 0/9] tools-power-x86-intel-speed-select: Fixes and updates for output Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 1/9] tools/power/x86/intel-speed-select: Fix package typo Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 2/9] tools/power/x86/intel-speed-select: Fix help option typo Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 3/9] tools/power/x86/intel-speed-select: Fix cpu-count output Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 4/9] tools/power/x86/intel-speed-select: Simplify output for turbo-freq and base-freq Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 5/9] tools/power/x86/intel-speed-select: Switch output to MHz Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 6/9] tools/power/x86/intel-speed-select: Change turbo ratio output to maximum turbo frequency Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 7/9] tools/power/x86/intel-speed-select: Output human readable CPU list Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 8/9] tools/power/x86/intel-speed-select: Output success/failed for command output Prarit Bhargava
2019-09-05 12:03 ` [PATCH v2 9/9] tools/power/x86/intel-speed-select: Fix memory leak Prarit Bhargava
2019-09-05 19:42 ` Srinivas Pandruvada [this message]
2019-09-05 20:56 ` Prarit Bhargava
2019-09-05 21:00 ` Prarit Bhargava
2019-09-05 23:05 ` [PATCH v2 0/9] tools-power-x86-intel-speed-select: Fixes and updates for output Srinivas Pandruvada
2019-09-07 18:13 ` Andy Shevchenko
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=f12560e59427ce7e038334a3b59bf084a748d998.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=darcari@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=prarit@redhat.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®