Commit 869f4fda authored by Dinghao Liu's avatar Dinghao Liu Committed by Pablo Neira Ayuso

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: 1cd472bf ("netfilter: nf_nat: add nat hook register functions to nf_nat")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Acked-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f6351c3f
...@@ -1174,6 +1174,7 @@ static int __init nf_nat_init(void) ...@@ -1174,6 +1174,7 @@ static int __init nf_nat_init(void)
ret = register_pernet_subsys(&nat_net_ops); ret = register_pernet_subsys(&nat_net_ops);
if (ret < 0) { if (ret < 0) {
nf_ct_extend_unregister(&nat_extend); nf_ct_extend_unregister(&nat_extend);
kvfree(nf_nat_bysource);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment