All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: jkmaline@cc.hut.fi
Cc: hostap@shmoo.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [2.6 patch] hostap_{pci,plx}.c: fix memory leaks
Date: Mon, 13 Mar 2006 23:28:41 +0100	[thread overview]
Message-ID: <20060313222841.GQ13973@stusta.de> (raw)

This patch fixes two memotry leaks spotted by the Coverity checker.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/net/wireless/hostap/hostap_pci.c |    6 +++---
 drivers/net/wireless/hostap/hostap_plx.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

--- linux-2.6.16-rc6-mm1-full/drivers/net/wireless/hostap/hostap_pci.c.old	2006-03-13 22:34:30.000000000 +0100
+++ linux-2.6.16-rc6-mm1-full/drivers/net/wireless/hostap/hostap_pci.c	2006-03-13 22:37:57.000000000 +0100
@@ -301,14 +301,14 @@ static int prism2_pci_probe(struct pci_d
 	struct hostap_interface *iface;
 	struct hostap_pci_priv *hw_priv;
 
+	if (pci_enable_device(pdev))
+		return -EIO;
+
 	hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
 	if (hw_priv == NULL)
 		return -ENOMEM;
 	memset(hw_priv, 0, sizeof(*hw_priv));
 
-	if (pci_enable_device(pdev))
-		return -EIO;
-
 	phymem = pci_resource_start(pdev, 0);
 
 	if (!request_mem_region(phymem, pci_resource_len(pdev, 0), "Prism2")) {
--- linux-2.6.16-rc6-mm1-full/drivers/net/wireless/hostap/hostap_plx.c.old	2006-03-13 22:39:40.000000000 +0100
+++ linux-2.6.16-rc6-mm1-full/drivers/net/wireless/hostap/hostap_plx.c	2006-03-13 22:40:09.000000000 +0100
@@ -446,14 +446,14 @@ static int prism2_plx_probe(struct pci_d
 	int tmd7160;
 	struct hostap_plx_priv *hw_priv;
 
+	if (pci_enable_device(pdev))
+		return -EIO;
+
 	hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
 	if (hw_priv == NULL)
 		return -ENOMEM;
 	memset(hw_priv, 0, sizeof(*hw_priv));
 
-	if (pci_enable_device(pdev))
-		return -EIO;
-
 	/* National Datacomm NCP130 based on TMD7160, not PLX9052. */
 	tmd7160 = (pdev->vendor == 0x15e8) && (pdev->device == 0x0131);
 


             reply	other threads:[~2006-03-13 22:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-13 22:28 Adrian Bunk [this message]
2006-03-14  2:25 ` [2.6 patch] hostap_{pci,plx}.c: fix memory leaks Herbert Xu
2006-03-14 14:30 ` Michael Buesch
2006-03-15  3:16 ` Jouni Malinen
2006-03-15  3:16   ` Jouni Malinen
2006-03-15 16:14   ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060313222841.GQ13973@stusta.de \
    --to=bunk@stusta.de \
    --cc=hostap@shmoo.com \
    --cc=jkmaline@cc.hut.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.