net_sched: fix two more memory leaks in cls_tcindex
authorCong Wang <xiyou.wangcong@gmail.com>
Mon, 11 Feb 2019 21:06:16 +0000 (13:06 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Feb 2019 09:08:59 +0000 (10:08 +0100)
commitd569cb5ac0c49a0069aac67e3bede113dd8a4777
tree039aad4fe2a4d892ad54066a3e10b916cac67d1c
parentdcd62aa6f895dfeb8c3b72366b012d003df78458
net_sched: fix two more memory leaks in cls_tcindex

[ Upstream commit 1db817e75f5b9387b8db11e37d5f0624eb9223e0 ]

struct tcindex_filter_result contains two parts:
struct tcf_exts and struct tcf_result.

For the local variable 'cr', its exts part is never used but
initialized without being released properly on success path. So
just completely remove the exts part to fix this leak.

For the local variable 'new_filter_result', it is never properly
released if not used by 'r' on success path.

Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/cls_tcindex.c