]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tipc/bearer: Fix resource leak in error path
authorPhil Sutter <phil@nwl.cc>
Thu, 17 Aug 2017 17:09:31 +0000 (19:09 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 18 Aug 2017 16:39:52 +0000 (09:39 -0700)
Signed-off-by: Phil Sutter <phil@nwl.cc>
tipc/bearer.c

index 810344f672af1d8966fd3ab1cfdea7ba19452b6f..c3d4491f8f6ef97d1c013981e3db3cb24dea670d 100644 (file)
@@ -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;
        }