netfilter: Fix memory leak in nf_register_net_hook
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 18 Jul 2015 15:21:14 +0000 (10:21 -0500)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 20 Jul 2015 07:15:50 +0000 (09:15 +0200)
commite317fa505dcdfa25f0e4c888f991eb7fd1562e1e
tree0ef02978e3d358a01d75109ca55f80f23d9bf643
parent6c7941dee9c41d6ab5a8be06ec44aa579a6123e1
netfilter: Fix memory leak in nf_register_net_hook

In the rare case that when it is a attempted to use a per network device
netfilter hook and the network device does not exist the newly allocated
structure can leak.

Be a good citizen and free the newly allocated structure in the error
handling code.

Fixes: 085db2c04557 ("netfilter: Per network namespace netfilter hooks.")
Reported-by: kbuild@01.org
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/core.c