diff mbox series

[05/20] net/bnxt: fix a memory leak in error handling

Message ID tencent_C00C29CFCE294484B48EE1F7DB089F485106@qq.com (mailing list archive)
State Changes Requested
Delegated to: David Marchand
Headers show
Series fix memory leaks in error handling | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Weiguo Li Feb. 22, 2022, 6:18 p.m. UTC
When run goto from this branch, the 'ulp_fc_info' has not set into
the context yet, so ulp_fc_mgr_deinit(ctxt) in the error label can
not release 'ulp_fc_info' in this case which cause a memory leak.

Fixes: 9cf9c8385df7 ("net/bnxt: add ULP flow counter manager")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
index 85c9cbb7f2..b055463ea4 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c
@@ -86,6 +86,7 @@  ulp_fc_mgr_init(struct bnxt_ulp_context *ctxt)
 
 	rc = pthread_mutex_init(&ulp_fc_info->fc_lock, NULL);
 	if (rc) {
+		rte_free(ulp_fc_info);
 		PMD_DRV_LOG(ERR, "Failed to initialize fc mutex\n");
 		goto error;
 	}