summaryrefslogtreecommitdiff
path: root/tipc
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-08-17 19:09:31 +0200
committerStephen Hemminger <stephen@networkplumber.org>2017-08-18 09:39:52 -0700
commitbe55416addf76e76836af6a4dd94b19c4186e1b2 (patch)
tree4ab1c77d524698c271e3ffa98e125b8707886826 /tipc
parent46131577cf1ba37198c82e1ce89c9bbca2153ef4 (diff)
tipc/bearer: Fix resource leak in error path
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tipc')
-rw-r--r--tipc/bearer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tipc/bearer.c b/tipc/bearer.c
index 810344f6..c3d4491f 100644
--- a/tipc/bearer.c
+++ b/tipc/bearer.c
@@ -163,6 +163,7 @@ static int nl_add_udp_enable_opts(struct nlmsghdr *nlh, struct opt *opts,
if (!remip) {
if (generate_multicast(loc->ai_family, buf, sizeof(buf))) {
fprintf(stderr, "Failed to generate multicast address\n");
+ freeaddrinfo(loc);
return -EINVAL;
}
remip = buf;
@@ -177,6 +178,8 @@ static int nl_add_udp_enable_opts(struct nlmsghdr *nlh, struct opt *opts,
if (rem->ai_family != loc->ai_family) {
fprintf(stderr, "UDP local and remote AF mismatch\n");
+ freeaddrinfo(rem);
+ freeaddrinfo(loc);
return -EINVAL;
}