nl80211: fix a few memory leaks in reg.c
The first leak occurs when entering the default case in the switch for the initiator in set_regdom. The second leaks a platform_device struct if the platform registration in regulatory_init succeeds but the sub sequent regulatory hint fails due to no memory. Signed-off-by: Ola Olsson <ola.olsson@sonymobile.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
b7bb110008
commit
09d118008f
|
@ -3029,6 +3029,7 @@ int set_regdom(const struct ieee80211_regdomain *rd,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN(1, "invalid initiator %d\n", lr->initiator);
|
WARN(1, "invalid initiator %d\n", lr->initiator);
|
||||||
|
kfree(rd);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3221,8 +3222,10 @@ int __init regulatory_init(void)
|
||||||
/* We always try to get an update for the static regdomain */
|
/* We always try to get an update for the static regdomain */
|
||||||
err = regulatory_hint_core(cfg80211_world_regdom->alpha2);
|
err = regulatory_hint_core(cfg80211_world_regdom->alpha2);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err == -ENOMEM)
|
if (err == -ENOMEM) {
|
||||||
|
platform_device_unregister(reg_pdev);
|
||||||
return err;
|
return err;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* N.B. kobject_uevent_env() can fail mainly for when we're out
|
* N.B. kobject_uevent_env() can fail mainly for when we're out
|
||||||
* memory which is handled and propagated appropriately above
|
* memory which is handled and propagated appropriately above
|
||||||
|
|
Loading…
Reference in a new issue