[v2] app/proc-info: add rte_eal_cleanup() to avoid memory leak

Message ID 20220904122845.141893-1-fidaullah.noonari@emumba.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series [v2] app/proc-info: add rte_eal_cleanup() to avoid memory leak |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Fidaullah Noonari Sept. 4, 2022, 12:28 p.m. UTC
  when app is launched with -m proc-info exit without
rte_eal_cleanup() causing memory leakage. This commit resolves the
memory leakage issue and closes app properly.

Bugzilla id: 898

Signed-off-by: Fidaullah Noonari <fidaullah.noonari@emumba.com>
---
 app/proc-info/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Stephen Hemminger July 16, 2023, 5:46 p.m. UTC | #1
On Sun,  4 Sep 2022 17:28:45 +0500
Fidaullah Noonari <fidaullah.noonari@emumba.com> wrote:

> when app is launched with -m proc-info exit without
> rte_eal_cleanup() causing memory leakage. This commit resolves the
> memory leakage issue and closes app properly.
> 
> Bugzilla id: 898

The new eventdev stats could have the same problem.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 1bfba5f60d..9cfcce31ab 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -1523,7 +1523,7 @@  main(int argc, char **argv)
 
 	if (mem_info) {
 		meminfo_display();
-		return 0;
+		goto cleanup;
 	}
 
 	nb_ports = rte_eth_dev_count_avail();
@@ -1593,6 +1593,7 @@  main(int argc, char **argv)
 	RTE_ETH_FOREACH_DEV(i)
 		rte_eth_dev_close(i);
 
+cleanup:
 	ret = rte_eal_cleanup();
 	if (ret)
 		printf("Error from rte_eal_cleanup(), %d\n", ret);