From 292611672bf0c8e9c0726b1c183111dddb7fbb1b Mon Sep 17 00:00:00 2001 From: Kishore Padmanabha Date: Fri, 17 Jul 2020 19:44:47 +0530 Subject: [PATCH] net/bnxt: fix null pointer dereference Avoid dereferencing a null pointer. Fixes: 313ac35ac701 ("net/bnxt: support ULP session manager init") Cc: stable@dpdk.org Signed-off-by: Kishore Padmanabha Signed-off-by: Somnath Kotur Reviewed-by: Mike Baucom --- drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c index b2c8c349c9..4df850f226 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c @@ -120,9 +120,11 @@ gfid_not_required: return 0; mem_error: - rte_free(mark_tbl->gfid_tbl); - rte_free(mark_tbl->lfid_tbl); - rte_free(mark_tbl); + if (mark_tbl) { + rte_free(mark_tbl->gfid_tbl); + rte_free(mark_tbl->lfid_tbl); + rte_free(mark_tbl); + } BNXT_TF_DBG(DEBUG, "Failed to allocate memory for mark mgr\n"); return -ENOMEM; } -- 2.20.1