diff options
author | Pavel Roskin <proski@gnu.org> | 2005-09-23 04:18:06 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-23 04:36:13 -0400 |
commit | f3cb4cc120177090b0ccc9fb20a12010de39ac8a (patch) | |
tree | 368c76f705f9512f5016288b607e3a0e4b36d54d /drivers/net/wireless | |
parent | 4c08202547111e503eca4031ae9443159a79e2b2 (diff) |
[PATCH] orinoco: Fix memory leak and unneeded unlock in orinoco_join_ap()
Signed-off-by: Pavel Roskin <proski@gnu.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.
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/orinoco.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index f76fe3d10248..8b93b44291d4 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -1046,7 +1046,7 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1046 | return; | 1046 | return; |
1047 | 1047 | ||
1048 | if (orinoco_lock(priv, &flags) != 0) | 1048 | if (orinoco_lock(priv, &flags) != 0) |
1049 | goto out; | 1049 | goto fail_lock; |
1050 | 1050 | ||
1051 | /* Sanity checks in case user changed something in the meantime */ | 1051 | /* Sanity checks in case user changed something in the meantime */ |
1052 | if (! priv->bssid_fixed) | 1052 | if (! priv->bssid_fixed) |
@@ -1091,8 +1091,10 @@ static void orinoco_join_ap(struct net_device *dev) | |||
1091 | printk(KERN_ERR "%s: Error issuing join request\n", dev->name); | 1091 | printk(KERN_ERR "%s: Error issuing join request\n", dev->name); |
1092 | 1092 | ||
1093 | out: | 1093 | out: |
1094 | kfree(buf); | ||
1095 | orinoco_unlock(priv, &flags); | 1094 | orinoco_unlock(priv, &flags); |
1095 | |||
1096 | fail_lock: | ||
1097 | kfree(buf); | ||
1096 | } | 1098 | } |
1097 | 1099 | ||
1098 | /* Send new BSSID to userspace */ | 1100 | /* Send new BSSID to userspace */ |