diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2016-09-10 00:56:55 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-13 11:28:32 -0400 |
commit | c20cb8119337052a84e40cba94af732d870e22e3 (patch) | |
tree | 855cbc716892fc388be6b6d38e2fe357108cd068 /net/tipc/udp_media.c | |
parent | 308433155a67cb097142292c8943e0aa8d1a1c79 (diff) | |
download | lwn-c20cb8119337052a84e40cba94af732d870e22e3.tar.gz lwn-c20cb8119337052a84e40cba94af732d870e22e3.zip |
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: ba5aa84a2d22 ("tipc: split UDP nl address parsing")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/udp_media.c')
-rw-r--r-- | net/tipc/udp_media.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index dd274687a53d..d80cd3f7503f 100644 --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c @@ -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, |