From c76f2481b60a62814f4cb1678e48efa3385895aa Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Mon, 26 Mar 2018 14:32:44 +0000 Subject: tipc: fix error handling in tipc_udp_enable() Release alloced resource before return from the error handling case in tipc_udp_enable(), otherwise will cause memory leak. Fixes: 52dfae5c85a4 ("tipc: obtain node identity from interface by default") Signed-off-by: Wei Yongjun Acked-by: Jon Maloy Signed-off-by: David S. Miller --- net/tipc/udp_media.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'net/tipc/udp_media.c') diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index 2c13b18426d9..e7d91f5d5cae 100644 --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c @@ -687,7 +687,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, } if (!tipc_own_id(net)) { pr_warn("Failed to set node id, please configure manually\n"); - return -EINVAL; + err = -EINVAL; + goto err; } b->bcast_addr.media_id = TIPC_MEDIA_TYPE_UDP; -- cgit v1.2.3