From: Jesper Juhl Date: Mon, 15 Oct 2007 08:39:12 +0000 (-0700) Subject: [NETLINK]: Don't leak 'listeners' in netlink_kernel_create() X-Git-Tag: MMI-PSA29.97-13-9~39886^2~27 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f937f1f46b6d2f9bef94e0d6b769a4c67615d34e;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [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 Acked-by: "Eric W. Biederman" Signed-off-by: David S. Miller --- 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, nl_table[unit].cb_mutex = cb_mutex; nl_table[unit].module = module; nl_table[unit].registered = 1; + } else { + kfree(listeners); } netlink_table_ungrab();