patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/nfp: fix memory leak
@ 2019-04-08 10:19 Alejandro Lucero
  2019-04-08 16:40 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Lucero @ 2019-04-08 10:19 UTC (permalink / raw)
  To: dev; +Cc: stable

If errors, release the allocated structure.

Coverity issue: 277222
Fixes: c7e9729da6b5 ("net/nfp: support CPP")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
---
 drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
index 93ee310f5..33baa989b 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
+++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c
@@ -865,24 +865,24 @@ nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev)
 	    cpp->driver_lock_needed) {
 		ret = nfp_acquire_process_lock(desc);
 		if (ret)
-			return -1;
+			goto error;
 	}
 
 	/* Just support for one secondary process */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 		ret = nfp_acquire_secondary_process_lock(desc);
 		if (ret)
-			return -1;
+			goto error;
 	}
 
 	if (nfp6000_set_model(dev, cpp) < 0)
-		return -1;
+		goto error;
 	if (nfp6000_set_interface(dev, cpp) < 0)
-		return -1;
+		goto error;
 	if (nfp6000_set_serial(dev, cpp) < 0)
-		return -1;
+		goto error;
 	if (nfp6000_set_barsz(dev, desc) < 0)
-		return -1;
+		goto error;
 
 	desc->cfg = (char *)dev->mem_resource[0].addr;
 
@@ -890,7 +890,11 @@ nfp6000_init(struct nfp_cpp *cpp, struct rte_pci_device *dev)
 
 	nfp_cpp_priv_set(cpp, desc);
 
-	return ret;
+	return 0;
+
+error:
+	free(desc);
+	return -1;
 }
 
 static void
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [PATCH] net/nfp: fix memory leak
  2019-04-08 10:19 [dpdk-stable] [PATCH] net/nfp: fix memory leak Alejandro Lucero
@ 2019-04-08 16:40 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2019-04-08 16:40 UTC (permalink / raw)
  To: Alejandro Lucero, dev; +Cc: stable

On 4/8/2019 11:19 AM, Alejandro Lucero wrote:
> If errors, release the allocated structure.
> 
> Coverity issue: 277222
> Fixes: c7e9729da6b5 ("net/nfp: support CPP")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-08 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 10:19 [dpdk-stable] [PATCH] net/nfp: fix memory leak Alejandro Lucero
2019-04-08 16:40 ` Ferruh Yigit

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).