]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: fix Rx queue telemetry memory leak on failure
authorYunjian Wang <wangyunjian@huawei.com>
Sat, 8 Jan 2022 07:51:57 +0000 (15:51 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 25 Jan 2022 09:58:32 +0000 (10:58 +0100)
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>
lib/ethdev/rte_ethdev.c

index a1d475a29295c323062b5bddc57695c3b7ca65ab..29e21ad580037e59e195bd47789da2cd9186383a 100644 (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);