naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0083-tipc-bearer-Fix-resource-leak-in-error-path.patch

36cfb7
From b6bf156c4d4abab8176112e48a595c3e7bb7f825 Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 29 Apr 2019 20:07:22 +0200
36cfb7
Subject: [PATCH] tipc/bearer: Fix resource leak in error path
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
36cfb7
Upstream Status: iproute2.git commit be55416addf76
36cfb7
36cfb7
commit be55416addf76e76836af6a4dd94b19c4186e1b2
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Thu Aug 17 19:09:31 2017 +0200
36cfb7
36cfb7
    tipc/bearer: Fix resource leak in error path
36cfb7
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 tipc/bearer.c | 3 +++
36cfb7
 1 file changed, 3 insertions(+)
36cfb7
36cfb7
diff --git a/tipc/bearer.c b/tipc/bearer.c
36cfb7
index 810344f672af1..c3d4491f8f6ef 100644
36cfb7
--- a/tipc/bearer.c
36cfb7
+++ b/tipc/bearer.c
36cfb7
@@ -163,6 +163,7 @@ static int nl_add_udp_enable_opts(struct nlmsghdr *nlh, struct opt *opts,
36cfb7
 	if (!remip) {
36cfb7
 		if (generate_multicast(loc->ai_family, buf, sizeof(buf))) {
36cfb7
 			fprintf(stderr, "Failed to generate multicast address\n");
36cfb7
+			freeaddrinfo(loc);
36cfb7
 			return -EINVAL;
36cfb7
 		}
36cfb7
 		remip = buf;
36cfb7
@@ -177,6 +178,8 @@ static int nl_add_udp_enable_opts(struct nlmsghdr *nlh, struct opt *opts,
36cfb7
 
36cfb7
 	if (rem->ai_family != loc->ai_family) {
36cfb7
 		fprintf(stderr, "UDP local and remote AF mismatch\n");
36cfb7
+		freeaddrinfo(rem);
36cfb7
+		freeaddrinfo(loc);
36cfb7
 		return -EINVAL;
36cfb7
 	}
36cfb7
 
36cfb7
-- 
e138d9
2.21.0
36cfb7