netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/8] orinoco: Fix memory leak and unneeded unlock in orinoco_join_ap()
@ 2005-09-23  8:18 Pavel Roskin
  0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-09-23  8:18 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: orinoco-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Signed-off-by: Pavel Roskin <proski-mXXj517/zsQ@public.gmane.org>

Fix memory leak and unneeded unlock in orinoco_join_ap()

If orinoco_lock() fails, the code would still run orinoco_unlock(),
instead of freeing the allocated memory.  Found by sparse.

diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -1046,7 +1046,7 @@ static void orinoco_join_ap(struct net_d
 		return;
 
 	if (orinoco_lock(priv, &flags) != 0)
-		goto out;
+		goto fail_lock;
 
 	/* Sanity checks in case user changed something in the meantime */
 	if (! priv->bssid_fixed)
@@ -1091,8 +1091,10 @@ static void orinoco_join_ap(struct net_d
 		printk(KERN_ERR "%s: Error issuing join request\n", dev->name);
 
  out:
-	kfree(buf);
 	orinoco_unlock(priv, &flags);
+
+ fail_lock:
+	kfree(buf);
 }
 
 /* Send new BSSID to userspace */



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-23  8:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-23  8:18 [PATCH 3/8] orinoco: Fix memory leak and unneeded unlock in orinoco_join_ap() Pavel Roskin

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