Function iavf_init_proto_xtr() allocates vf->proto_xtr as part of the
device init sequence, but no shutdown function frees this memory again.
Add appropriate free calls to fix this memory leak.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
V3: add free call to close function to free memory on normal, non-error
    path.
---
 drivers/net/intel/iavf/iavf_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c 
b/drivers/net/intel/iavf/iavf_ethdev.c
index 1cd8c88384..d601ec3b6a 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -2757,6 +2757,8 @@ iavf_uninit_vf(struct rte_eth_dev *dev)
        vf->qos_cap = NULL;
        free(vf->qtc_map);
        vf->qtc_map = NULL;
+       rte_free(vf->proto_xtr);
+       vf->proto_xtr = NULL;
 
        rte_free(vf->rss_lut);
        vf->rss_lut = NULL;
@@ -3255,6 +3257,9 @@ iavf_dev_close(struct rte_eth_dev *dev)
                }
        }
 
+       rte_free(vf->proto_xtr);
+       vf->proto_xtr = NULL;
+
        rte_free(vf->vf_res);
        vf->vsi_res = NULL;
        vf->vf_res = NULL;
-- 
2.53.0

Reply via email to