Skip to content

Commit

Permalink
[PATCH] orinoco: Fix memory leak and unneeded unlock in orinoco_join_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Pavel Roskin authored and Jeff Garzik committed Sep 23, 2005
1 parent 4c08202 commit f3cb4cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/orinoco.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ static void orinoco_join_ap(struct net_device *dev)
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)
Expand Down Expand Up @@ -1091,8 +1091,10 @@ static void orinoco_join_ap(struct net_device *dev)
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 */
Expand Down

0 comments on commit f3cb4cc

Please sign in to comment.