From: David Marchand <david.marchand@redhat.com>
To: Rory Sexton <rory.sexton@intel.com>
Cc: dev <dev@dpdk.org>, David Hunt <david.hunt@intel.com>,
"Kovacevic, Marko" <marko.kovacevic@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/1] examples/vm_power_manager: fix resource leak
Date: Fri, 30 Oct 2020 13:30:08 +0100 [thread overview]
Message-ID: <CAJFAV8wNdPHNQdnAnGdY8d2dMnVKP3V1eH_urhEq+SasQ6zG8w@mail.gmail.com> (raw)
In-Reply-To: <20200729083754.1044630-1-rory.sexton@intel.com>
On Wed, Jul 29, 2020 at 10:38 AM Rory Sexton <rory.sexton@intel.com> wrote:
>
> Fix memory leak where variable oob_enable can go out of scope leaking
> the storage it points to.
>
> Coverity issue: 337674
> Fixes: 95f648ff9ee ("examples/vm_power: make branch ratio threshold per core")
>
> Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
Applied, thanks Rory.
There is another issue in this code.
Previous branches part of the 'b' option handling will break from the
parsing loop and have the parse_args() function return the option
index where it stopped.
This should instead report a parsing error and have the app fail to initialise.
Something like:
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 75d5b5364f..2c394b60fc 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -194,7 +194,7 @@ parse_args(int argc, char **argv)
"core-branch-ratio matrix - [%s]\n",
optarg);
free(oob_enable);
- break;
+ return -1;
}
cnt = parse_branch_ratio(optarg, &branch_ratio);
if (cnt < 0) {
@@ -202,7 +202,7 @@ parse_args(int argc, char **argv)
"core-branch-ratio matrix - [%s]\n",
optarg);
free(oob_enable);
- break;
+ return -1;
}
if (branch_ratio <= 0.0 || branch_ratio > 100.0) {
printf("invalid branch ratio specified\n");
Could you test this and send a followup patch?
Thanks.
--
David Marchand
prev parent reply other threads:[~2020-10-30 12:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 8:37 Rory Sexton
2020-09-18 8:13 ` David Hunt
2020-10-30 12:30 ` David Marchand [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=CAJFAV8wNdPHNQdnAnGdY8d2dMnVKP3V1eH_urhEq+SasQ6zG8w@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=marko.kovacevic@intel.com \
--cc=rory.sexton@intel.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;
as well as URLs for NNTP newsgroup(s).