ethdev: fix Rx queue telemetry memory leak on failure

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>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Yunjian Wang 2022-01-08 15:51:57 +08:00 committed by Ferruh Yigit
parent bce33776a7
commit 52b49ea06f

View File

@ -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);