1
0
Fork 0

tipc: fix memory leak in tipc_accept_from_sock()

[ Upstream commit a7d5f107b4 ]

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 <davem@davemloft.net>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/10/head
Jon Maloy 2017-12-04 22:00:20 +01:00 committed by Greg Kroah-Hartman
parent 6efcd7eada
commit 1933fa4851
1 changed files with 1 additions and 0 deletions

View File

@ -313,6 +313,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;
}