naccyde / rpms / iproute

Forked from rpms/iproute 10 months ago
Clone

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

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