[05/20] net/bnxt: fix a memory leak in error handling
Checks
Commit Message
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(+)
@@ -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;
}