提交 f3cb4cc1 编写于 作者: P Pavel Roskin 提交者: Jeff Garzik

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

Signed-off-by: NPavel 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: NJeff Garzik <jgarzik@pobox.com>
上级 4c082025
...@@ -1046,7 +1046,7 @@ static void orinoco_join_ap(struct net_device *dev) ...@@ -1046,7 +1046,7 @@ static void orinoco_join_ap(struct net_device *dev)
return; return;
if (orinoco_lock(priv, &flags) != 0) if (orinoco_lock(priv, &flags) != 0)
goto out; goto fail_lock;
/* Sanity checks in case user changed something in the meantime */ /* Sanity checks in case user changed something in the meantime */
if (! priv->bssid_fixed) if (! priv->bssid_fixed)
...@@ -1091,8 +1091,10 @@ static void orinoco_join_ap(struct net_device *dev) ...@@ -1091,8 +1091,10 @@ static void orinoco_join_ap(struct net_device *dev)
printk(KERN_ERR "%s: Error issuing join request\n", dev->name); printk(KERN_ERR "%s: Error issuing join request\n", dev->name);
out: out:
kfree(buf);
orinoco_unlock(priv, &flags); orinoco_unlock(priv, &flags);
fail_lock:
kfree(buf);
} }
/* Send new BSSID to userspace */ /* Send new BSSID to userspace */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册