netfilter: nf_nat: Fix memleak in nf_nat_init
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sat, 9 Jan 2021 12:01:21 +0000 (20:01 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 10 Jan 2021 23:34:11 +0000 (00:34 +0100)
commit869f4fdaf4ca7bb6e0d05caf6fa1108dddc346a7
tree94e517af001f36994064d62d1054c6f26c4ca1ac
parentf6351c3f1c27c80535d76cac2299aec44c36291e
netfilter: nf_nat: Fix memleak in nf_nat_init

When register_pernet_subsys() fails, nf_nat_bysource
should be freed just like when nf_ct_extend_register()
fails.

Fixes: 1cd472bf036ca ("netfilter: nf_nat: add nat hook register functions to nf_nat")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_core.c