net/bnxt: free memory allocated for VF filters
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Tue, 17 Apr 2018 01:11:23 +0000 (18:11 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 14:54:56 +0000 (15:54 +0100)
Memory allocated to hold VF filter info is not being freed currently.
This can cause potential memory leak.

Fixes: 7a5b0874440e ("net/bnxt: support to add a VF MAC address")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_filter.c

index 1793495..c92806b 100644 (file)
@@ -131,6 +131,14 @@ void bnxt_free_filter_mem(struct bnxt *bp)
 
        rte_free(bp->filter_info);
        bp->filter_info = NULL;
+
+       for (i = 0; i < bp->pf.max_vfs; i++) {
+               STAILQ_FOREACH(filter, &bp->pf.vf_info[i].filter, next) {
+                       rte_free(filter);
+                       STAILQ_REMOVE(&bp->pf.vf_info[i].filter, filter,
+                                     bnxt_filter_info, next);
+               }
+       }
 }
 
 int bnxt_alloc_filter_mem(struct bnxt *bp)