From: Rahul Lakkireddy Date: Fri, 12 Feb 2016 11:45:30 +0000 (+0530) Subject: cxgbe: fix memory leak after initialization failure X-Git-Tag: spdx-start~7421 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1c1789ccb329df1cfd4d299b8c9898bd2fd2f38b;p=dpdk.git cxgbe: fix memory leak after initialization failure Add missing code to free adapter when the device initialization fails. Fixes: 8318984927ff ("cxgbe: add pmd skeleton") Reported-by: Seth Arnold Signed-off-by: Rahul Lakkireddy Signed-off-by: Kumar Sanghvi --- diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 97ef152e46..1a4293d296 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -838,11 +838,16 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) pi->adapter = adapter; err = cxgbe_probe(adapter); - if (err) + if (err) { dev_err(adapter, "%s: cxgbe probe failed with err %d\n", __func__, err); + goto out_free_adapter; + } + + return 0; out_free_adapter: + rte_free(adapter); return err; }