net: sched: act_ife: fix memory leak in ife init

Free params if tcf_idr_check_alloc() returned error.

Fixes: 0190c1d452 ("net: sched: atomically check-allocate action")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vlad Buslov 2018-07-09 14:33:26 +03:00 committed by David S. Miller
parent 8dce04f1fd
commit 01e866bf07
1 changed files with 3 additions and 1 deletions

View File

@ -485,8 +485,10 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
return -ENOMEM;
err = tcf_idr_check_alloc(tn, &parm->index, a, bind);
if (err < 0)
if (err < 0) {
kfree(p);
return err;
}
exists = err;
if (exists && bind) {
kfree(p);