Commit c20cb811 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

tipc: fix possible memory leak in tipc_udp_enable()

'ub' is malloced in tipc_udp_enable() and should be freed before
leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: ba5aa84a ("tipc: split UDP nl address parsing")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30843315
...@@ -665,7 +665,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b, ...@@ -665,7 +665,8 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) { if (!opts[TIPC_NLA_UDP_LOCAL] || !opts[TIPC_NLA_UDP_REMOTE]) {
pr_err("Invalid UDP bearer configuration"); pr_err("Invalid UDP bearer configuration");
return -EINVAL; err = -EINVAL;
goto err;
} }
err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local, err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment