patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: fix rxq_state leak in error path
@ 2022-01-08  7:51 Yunjian Wang
  2022-01-25  9:59 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Yunjian Wang @ 2022-01-08  7:51 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, thomas, gmuthukrishn, dingxiaoxiong, xudingke,
	Yunjian Wang, stable

In eth_dev_handle_port_info() allocated memory for rxq_state,
we should free it when error happens, otherwise it will lead
to memory leak.

Fixes: 58b43c1ddfd1 ("ethdev: add telemetry endpoint for device info")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 lib/ethdev/rte_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index a1d475a292..29e21ad580 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -6320,8 +6320,10 @@ eth_dev_handle_port_info(const char *cmd __rte_unused,
 		return -ENOMEM;
 
 	txq_state = rte_tel_data_alloc();
-	if (!txq_state)
+	if (!txq_state) {
+		rte_tel_data_free(rxq_state);
 		return -ENOMEM;
+	}
 
 	rte_tel_data_start_dict(d);
 	rte_tel_data_add_dict_string(d, "name", eth_dev->data->name);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-25  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08  7:51 [dpdk-dev] [PATCH] ethdev: fix rxq_state leak in error path Yunjian Wang
2022-01-25  9:59 ` Ferruh Yigit

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).