[19/63] net/ice/base: fix memory leak issue

Message ID 20190826105105.19121-20-qi.z.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series net/ice/base: update base code |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang Aug. 26, 2019, 10:50 a.m. UTC
  Need to free new ice_vsig_prof if no valid ptype can be found.

Fixes: d935fb5bb091 ("net/ice/base: fix packet type size")
Cc: stable@dpdk.org

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 73362c909..7daaf10b0 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -4918,8 +4918,10 @@  ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk,
 		p->tcam[i].prof_id = map->prof_id;
 		p->tcam[i].tcam_idx = ICE_INVALID_TCAM;
 
-		if (ice_ptg_find_ptype(hw, blk, map->ptype[i], &ptg))
+		if (ice_ptg_find_ptype(hw, blk, map->ptype[i], &ptg)) {
+			ice_free(hw, p);
 			return ICE_ERR_CFG;
+		}
 
 		p->tcam[i].ptg = ptg;
 	}