* [dpdk-dev] [PATCH] cxgbe: fix memory leak when device initialization fails
@ 2016-02-12 11:45 Rahul Lakkireddy
2016-02-12 12:06 ` Bruce Richardson
0 siblings, 1 reply; 2+ messages in thread
From: Rahul Lakkireddy @ 2016-02-12 11:45 UTC (permalink / raw)
To: dev; +Cc: Kumar Sanghvi, Nirranjan Kirubaharan
Add missing code to free adapter when the device initialization fails.
Fixes: 8318984927ff ("cxgbe: add pmd skeleton")
Reported-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
---
drivers/net/cxgbe/cxgbe_ethdev.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 97ef152..1a4293d 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;
}
--
2.5.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] cxgbe: fix memory leak when device initialization fails
2016-02-12 11:45 [dpdk-dev] [PATCH] cxgbe: fix memory leak when device initialization fails Rahul Lakkireddy
@ 2016-02-12 12:06 ` Bruce Richardson
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Richardson @ 2016-02-12 12:06 UTC (permalink / raw)
To: Rahul Lakkireddy; +Cc: dev, Kumar Sanghvi, Nirranjan Kirubaharan
On Fri, Feb 12, 2016 at 05:15:30PM +0530, Rahul Lakkireddy wrote:
> Add missing code to free adapter when the device initialization fails.
>
> Fixes: 8318984927ff ("cxgbe: add pmd skeleton")
>
> Reported-by: Seth Arnold <seth.arnold@canonical.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
> Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
> ---
> drivers/net/cxgbe/cxgbe_ethdev.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
You caught me just at a good time - I was just finishing pushing your two
other bug fixes when this arrived in. :-)
Applied to dpdk-next-net/rel_16_04
Thanks,
/Bruce
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-12 12:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12 11:45 [dpdk-dev] [PATCH] cxgbe: fix memory leak when device initialization fails Rahul Lakkireddy
2016-02-12 12:06 ` Bruce Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).