aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2007-10-15 04:39:12 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-15 15:26:32 -0400
commitf937f1f46b6d2f9bef94e0d6b769a4c67615d34e (patch)
tree4aadb89d07e7bb0789d5a754e65db686f339f07c /net
parent1dff92e09eb3adfcf3d3dffd0507b850f911f280 (diff)
[NETLINK]: Don't leak 'listeners' in netlink_kernel_create()
The Coverity checker spotted that we'll leak the storage allocated to 'listeners' in netlink_kernel_create() when the if (!nl_table[unit].registered) check is false. This patch avoids the leak. Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/af_netlink.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c776bcd9f825..98e313e5e594 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1378,6 +1378,8 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups,
1378 nl_table[unit].cb_mutex = cb_mutex; 1378 nl_table[unit].cb_mutex = cb_mutex;
1379 nl_table[unit].module = module; 1379 nl_table[unit].module = module;
1380 nl_table[unit].registered = 1; 1380 nl_table[unit].registered = 1;
1381 } else {
1382 kfree(listeners);
1381 } 1383 }
1382 netlink_table_ungrab(); 1384 netlink_table_ungrab();
1383 1385