From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Cc: Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-dev] [PATCH] dpdk-procinfo: free allocated xstats memory upon failure
Date: Tue, 4 Oct 2016 17:42:22 +0100 [thread overview]
Message-ID: <1475599342-12338-1-git-send-email-reshma.pattan@intel.com> (raw)
Some of the failures cases inside the nic_xstats_display()
function doesn't free the allocated memory for the xstats and
their names, memory is freed now.
Fixes: e2aae1c1 ("ethdev: remove name from extended statistic fetch")
Fixes: 22561383 ("app: replace dump_cfg by proc_info")
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
app/proc_info/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/proc_info/main.c b/app/proc_info/main.c
index 8246fb2..2c56d10 100644
--- a/app/proc_info/main.c
+++ b/app/proc_info/main.c
@@ -268,7 +268,7 @@ nic_xstats_display(uint8_t port_id)
if (len != rte_eth_xstats_get_names(
port_id, xstats_names, len)) {
printf("Cannot get xstat names\n");
- return;
+ goto err;
}
printf("###### NIC extended statistics for port %-2d #########\n",
@@ -278,8 +278,7 @@ nic_xstats_display(uint8_t port_id)
ret = rte_eth_xstats_get(port_id, xstats, len);
if (ret < 0 || ret > len) {
printf("Cannot get xstats\n");
- free(xstats);
- return;
+ goto err;
}
for (i = 0; i < len; i++)
@@ -289,6 +288,7 @@ nic_xstats_display(uint8_t port_id)
printf("%s############################\n",
nic_stats_border);
+err:
free(xstats);
free(xstats_names);
}
--
2.7.4
next reply other threads:[~2016-10-04 16:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 16:42 Reshma Pattan [this message]
2016-10-12 13:28 ` Thomas Monjalon
2016-10-12 13:29 ` Remy Horton
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=1475599342-12338-1-git-send-email-reshma.pattan@intel.com \
--to=reshma.pattan@intel.com \
--cc=dev@dpdk.org \
/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).