From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 102052BA6 for ; Tue, 4 Oct 2016 18:42:29 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 04 Oct 2016 09:42:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,444,1473145200"; d="scan'208";a="886630914" Received: from sivswdev02.ir.intel.com (HELO localhost.localdomain) ([10.237.217.46]) by orsmga003.jf.intel.com with ESMTP; 04 Oct 2016 09:42:28 -0700 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan Date: Tue, 4 Oct 2016 17:42:22 +0100 Message-Id: <1475599342-12338-1-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] dpdk-procinfo: free allocated xstats memory upon failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2016 16:42:30 -0000 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 --- 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