From 21b5bd0d66cfc05e70463fdbe6dc00404860ca34 Mon Sep 17 00:00:00 2001 From: Remy Horton Date: Mon, 20 Jun 2016 16:23:06 +0100 Subject: [PATCH] app/testpmd: fix memory leaks after xstats errors Fixes memory leaks detected by Coverity. These are due to ephemeral memory allocations not being freed when errors occur. Coverity issue: 127348 Fixes: e2aae1c1ced9 ("ethdev: remove name from extended statistic fetch") Signed-off-by: Remy Horton --- app/test-pmd/config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 10f0a36604..cb71c0962c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -281,6 +281,7 @@ nic_xstats_display(portid_t port_id) if (cnt_xstats != rte_eth_xstats_get_names( port_id, xstats_names, cnt_xstats)) { printf("Error: Cannot get xstats lookup\n"); + free(xstats_names); return; } @@ -293,6 +294,8 @@ nic_xstats_display(portid_t port_id) } if (cnt_xstats != rte_eth_xstats_get(port_id, xstats, cnt_xstats)) { printf("Error: Unable to get xstats\n"); + free(xstats_names); + free(xstats); return; } -- 2.20.1