From: Jon Maloy Date: Mon, 4 Dec 2017 21:00:20 +0000 (+0100) Subject: tipc: fix memory leak in tipc_accept_from_sock() X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~6361^2~29 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=a7d5f107b4978e08eeab599ee7449af34d034053;p=mirror_ubuntu-focal-kernel.git tipc: fix memory leak in tipc_accept_from_sock() When the function tipc_accept_from_sock() fails to create an instance of struct tipc_subscriber it omits to free the already created instance of struct tipc_conn instance before it returns. We fix that with this commit. Reported-by: David S. Miller Signed-off-by: Jon Maloy Signed-off-by: David S. Miller --- diff --git a/net/tipc/server.c b/net/tipc/server.c index 2710101ba4c1..d60c30342327 100644 --- a/net/tipc/server.c +++ b/net/tipc/server.c @@ -314,6 +314,7 @@ static int tipc_accept_from_sock(struct tipc_conn *con) newcon->usr_data = s->tipc_conn_new(newcon->conid); if (!newcon->usr_data) { sock_release(newsock); + conn_put(newcon); return -ENOMEM; }