Blame SOURCES/rpcbind-1.2.5-covscan-resource-leaks.patch

1b628f
diff -up rpcbind-1.2.5/src/rpcbind.c.orig rpcbind-1.2.5/src/rpcbind.c
1b628f
--- rpcbind-1.2.5/src/rpcbind.c.orig	2020-02-06 14:19:34.199330296 -0500
1b628f
+++ rpcbind-1.2.5/src/rpcbind.c	2020-02-06 14:20:19.069973902 -0500
1b628f
@@ -350,7 +350,7 @@ init_transport(struct netconfig *nconf)
1b628f
 {
1b628f
 	int fd = -1;
1b628f
 	struct t_bind taddr;
1b628f
-	struct addrinfo hints, *res;
1b628f
+	struct addrinfo hints, *res = NULL;
1b628f
 	struct __rpc_sockinfo si;
1b628f
 	SVCXPRT	*my_xprt = NULL;
1b628f
 	int status;	/* bound checking ? */
1b628f
@@ -827,8 +827,12 @@ got_socket:
1b628f
 	}
1b628f
 #endif
1b628f
 
1b628f
+	if (res != NULL)
1b628f
+		freeaddrinfo(res);
1b628f
 	return (0);
1b628f
 error:
1b628f
+	if (res != NULL)
1b628f
+		freeaddrinfo(res);
1b628f
 	close(fd);
1b628f
 	return (1);
1b628f
 }
1b628f
diff -up rpcbind-1.2.5/src/rpcb_stat.c.orig rpcbind-1.2.5/src/rpcb_stat.c
1b628f
--- rpcbind-1.2.5/src/rpcb_stat.c.orig	2018-08-15 10:51:19.000000000 -0400
1b628f
+++ rpcbind-1.2.5/src/rpcb_stat.c	2020-02-06 14:20:19.073973959 -0500
1b628f
@@ -151,7 +151,7 @@ rpcbs_rmtcall(rpcvers_t rtype, rpcproc_t
1b628f
 	rpcbs_rmtcalllist *rl;
1b628f
 	struct netconfig *nconf;
1b628f
 
1b628f
-	if (rtype > RPCBVERS_STAT)
1b628f
+	if (rtype >= RPCBVERS_STAT)
1b628f
 		return;
1b628f
 	for (rl = inf[rtype].rmtinfo; rl; rl = rl->next) {
1b628f
 
1b628f
diff -up rpcbind-1.2.5/src/rpcinfo.c.orig rpcbind-1.2.5/src/rpcinfo.c
1b628f
--- rpcbind-1.2.5/src/rpcinfo.c.orig	2020-02-06 14:19:34.193330210 -0500
1b628f
+++ rpcbind-1.2.5/src/rpcinfo.c	2020-02-06 14:20:19.073973959 -0500
1b628f
@@ -693,11 +693,11 @@ reply_proc (res, who, nconf)
1b628f
     }
1b628f
   if (!(uaddr = taddr2uaddr (nconf, who)))
1b628f
     {
1b628f
-      uaddr = UNKNOWN;
1b628f
+      printf ("%s\t%s\n", UNKNOWN, hostname);
1b628f
+    } else {
1b628f
+      printf ("%s\t%s\n", uaddr, hostname);
1b628f
+      free ((char *) uaddr);
1b628f
     }
1b628f
-  printf ("%s\t%s\n", uaddr, hostname);
1b628f
-  if (strcmp (uaddr, UNKNOWN))
1b628f
-    free ((char *) uaddr);
1b628f
   return (FALSE);
1b628f
 }
1b628f
 
1b628f
diff -up rpcbind-1.2.5/src/util.c.orig rpcbind-1.2.5/src/util.c
1b628f
--- rpcbind-1.2.5/src/util.c.orig	2020-02-06 14:20:51.564439986 -0500
1b628f
+++ rpcbind-1.2.5/src/util.c	2020-02-06 14:20:39.994274027 -0500
1b628f
@@ -322,13 +322,20 @@ network_init()
1b628f
 	/*
1b628f
 	 * Now join the RPC ipv6 multicast group on all interfaces.
1b628f
 	 */
1b628f
-	if (getifaddrs(&ifp) < 0)
1b628f
+	if (getifaddrs(&ifp) < 0) {
1b628f
+		freeaddrinfo (res);
1b628f
 		return;
1b628f
-
1b628f
+	}
1b628f
 	mreq6.ipv6mr_interface = 0;
1b628f
 	inet_pton(AF_INET6, RPCB_MULTICAST_ADDR, &mreq6.ipv6mr_multiaddr);
1b628f
 
1b628f
 	s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
1b628f
+	if (s < 0) {
1b628f
+	    if (debugging)
1b628f
+		    fprintf(stderr, "socket(AF_INET6) failed: %s\n", strerror(errno));
1b628f
+	    freeaddrinfo (res);
1b628f
+	    return;
1b628f
+	}
1b628f
 
1b628f
 	/*
1b628f
 	 * Loop through all interfaces. For each IPv6 multicast-capable
1b628f
@@ -351,9 +358,9 @@ network_init()
1b628f
 			if (debugging)
1b628f
 				perror("setsockopt v6 multicast");
1b628f
 	}
1b628f
+	close(s);
1b628f
 #endif
1b628f
-
1b628f
-	/* close(s); */
1b628f
+	freeaddrinfo (res);
1b628f
 }
1b628f
 
1b628f
 struct sockaddr *