@@ -685,7 +685,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
/* No channels found? */
if (!i) {
err = -EINVAL;
- goto out;
+ goto out_free;
}
/* Set real number of channels specified in creq->channels[] */
@@ -696,7 +696,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) {
err = -EINVAL;
- goto out;
+ goto out_free;
}
memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len);
creq->ssids[0].ssid_len = wreq->essid_len;
@@ -717,6 +717,9 @@ int cfg80211_wext_siwscan(struct net_device *dev,
out:
cfg80211_unlock_rdev(rdev);
return err;
+out_free:
+ kfree(creq);
+ goto out;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan);