mac80211_hwsim: fix a possible memory leak in hwsim_new_radio_nl()

'hwname' should be freed before leaving from the error handling cases,
otherwise it will cause mem leak

Fixes: cb1a5bae56 ("mac80211_hwsim: add permanent mac address option for new radios")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
YueHaibing 2018-04-24 11:08:35 +08:00 committed by Johannes Berg
parent 2f0605a697
commit e8f90c74e6
1 changed files with 1 additions and 0 deletions

View File

@ -3236,6 +3236,7 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
NL_SET_BAD_ATTR(info->extack,
info->attrs[HWSIM_ATTR_PERM_ADDR]);
kfree(hwname);
return -EINVAL;
}