ieee802154: Fix memory leak in ieee802154_add_iface()

Fix a memory leak in the ieee802154_add_iface() error handling path.
Detected by Coverity: CID 710490.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christian Engelmayer 2014-01-11 22:19:30 +01:00 committed by David S. Miller
parent fdc3452cd2
commit 267d29a69c

View File

@ -221,8 +221,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) { if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) {
type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]); type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]);
if (type >= __IEEE802154_DEV_MAX) if (type >= __IEEE802154_DEV_MAX) {
return -EINVAL; rc = -EINVAL;
goto nla_put_failure;
}
} }
dev = phy->add_iface(phy, devname, type); dev = phy->add_iface(phy, devname, type);