Skip to content

Commit

Permalink
tipc: fix possible memory leak in tipc_udp_enable()
Browse files Browse the repository at this point in the history
'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: ba5aa84 ("tipc: split UDP nl address parsing")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and davem330 committed Sep 13, 2016
1 parent 3084331 commit c20cb81
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 @@ -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]) {
pr_err("Invalid UDP bearer configuration");
return -EINVAL;
err = -EINVAL;
goto err;
}

err = tipc_parse_udp_addr(opts[TIPC_NLA_UDP_LOCAL], &local,
Expand Down

0 comments on commit c20cb81

Please sign in to comment.