* [PATCH -next] tipc: fix possible memory leak in tipc_udp_enable()
@ 2016-09-10 0:56 Wei Yongjun
2016-09-13 15:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-09-10 0:56 UTC (permalink / raw)
To: Jon Maloy, Ying Xue, David S. Miller, Richard Alpe
Cc: Wei Yongjun, netdev, tipc-discussion
From: Wei Yongjun <weiyongjun1@huawei.com>
'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>
---
net/tipc/udp_media.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index dd27468..d80cd3f 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,
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-13 15:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-10 0:56 [PATCH -next] tipc: fix possible memory leak in tipc_udp_enable() Wei Yongjun
2016-09-13 15:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).