Skip to contentSkip to conversation

orinoco: Fix memory leak and unneeded unlock in orinoco_join_ap()

PATCH In review Pavel Roskin 1 participant 1 message Sep 23, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/8 orinoco: Fix memory leak and unneeded unlock in orinoco_join_ap()

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.

drivers/net/wireless/orinoco.c +4 -2
@@ -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