act: fix memory leak in rtnl_act_parse()

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-04-30 14:29:46 +02:00
parent b8d90d9bb1
commit 35f44734bc

View file

@ -384,6 +384,7 @@ void rtnl_act_put_all(struct rtnl_act **head)
int rtnl_act_parse(struct rtnl_act **head, struct nlattr *tb)
{
struct rtnl_act *act;
struct rtnl_tc_ops *ops;
struct nlattr *tb2[TCA_ACT_MAX + 1];
struct nlattr *nla[TCA_ACT_MAX_PRIO + 1];
@ -396,7 +397,6 @@ int rtnl_act_parse(struct rtnl_act **head, struct nlattr *tb)
return err;
for (i = 0; i < TCA_ACT_MAX_PRIO && nla[i]; i++) {
struct rtnl_act *act;
struct rtnl_tc *tc;
act = rtnl_act_alloc();
@ -447,6 +447,7 @@ int rtnl_act_parse(struct rtnl_act **head, struct nlattr *tb)
return 0;
err_free:
rtnl_act_put (act);
rtnl_act_put_all(head);
return err;