From: Tom Herbert <t...@herbertland.com> Date: Mon, 17 Aug 2015 11:59:17 -0700
> +static int ila_build_state(struct net_device *dev, struct nlattr *nla, > + struct lwtunnel_state **ts) > +{ > + struct ila_params *p; > + struct nlattr *tb[ILA_ATTR_MAX + 1]; > + size_t encap_len = sizeof(*p); > + struct lwtunnel_state *newts; > + int ret; > + > + ret = nla_parse_nested(tb, ILA_ATTR_MAX, nla, > + ila_nl_policy); > + if (ret < 0) > + return ret; > + > + newts = lwtunnel_state_alloc(encap_len); > + if (!newts) > + return -ENOMEM; > + > + newts->len = encap_len; > + p = ila_params_lwtunnel(newts); > + > + if (!tb[ILA_ATTR_LOCATOR]) > + return -EINVAL; This final error check leaks 'newts'. You should probably just validate that ILA_ATTR_LOCATOR is present before allocating any resources at all. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html