Skip to content

Commit

Permalink
tipc: fix error handling in tipc_udp_enable()
Browse files Browse the repository at this point in the history
Release alloced resource before return from the error handling
case in tipc_udp_enable(), otherwise will cause memory leak.

Fixes: 52dfae5 ("tipc: obtain node identity from interface by default")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Mar 27, 2018
1 parent 6a91ded commit c76f248
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/tipc/udp_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c76f248

Please sign in to comment.