Blame SOURCES/libtirpc-1.1.4-covscan.patch

007e4b
diff --git a/src/auth_gss.c b/src/auth_gss.c
007e4b
index 5959893..7d08262 100644
007e4b
--- a/src/auth_gss.c
007e4b
+++ b/src/auth_gss.c
007e4b
@@ -207,6 +207,7 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec)
007e4b
 			rpc_createerr.cf_stat = RPC_SYSTEMERROR;
007e4b
 			rpc_createerr.cf_error.re_errno = ENOMEM;
007e4b
 			free(auth);
007e4b
+			free(gd);
007e4b
 			return (NULL);
007e4b
 		}
007e4b
 	}
007e4b
@@ -592,7 +593,7 @@ _rpc_gss_refresh(AUTH *auth, rpc_gss_options_ret_t *options_ret)
007e4b
 			if (rpc_gss_oid_to_mech(actual_mech_type, &mechanism)) {
007e4b
 				strncpy(options_ret->actual_mechanism,
007e4b
 					mechanism,
007e4b
-					sizeof(options_ret->actual_mechanism));
007e4b
+					(sizeof(options_ret->actual_mechanism)-1));
007e4b
 			}
007e4b
 
007e4b
 			gd->established = TRUE;
007e4b
diff --git a/src/clnt_bcast.c b/src/clnt_bcast.c
007e4b
index 98cf061..2ad6c89 100644
007e4b
--- a/src/clnt_bcast.c
007e4b
+++ b/src/clnt_bcast.c
007e4b
@@ -330,6 +330,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
007e4b
 	if (nettype == NULL)
007e4b
 		nettype = "datagram_n";
007e4b
 	if ((handle = __rpc_setconf(nettype)) == NULL) {
007e4b
+		AUTH_DESTROY(sys_auth);
007e4b
 		return (RPC_UNKNOWNPROTO);
007e4b
 	}
007e4b
 	while ((nconf = __rpc_getconf(handle)) != NULL) {
007e4b
diff --git a/src/getnetconfig.c b/src/getnetconfig.c
007e4b
index 92e7c43..d67d97d 100644
007e4b
--- a/src/getnetconfig.c
007e4b
+++ b/src/getnetconfig.c
007e4b
@@ -709,6 +709,8 @@ struct netconfig	*ncp;
007e4b
     p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *));
007e4b
     if (p->nc_lookups == NULL) {
007e4b
 	free(p->nc_netid);
007e4b
+	free(p);
007e4b
+	free(tmp);
007e4b
 	return(NULL);
007e4b
     }
007e4b
     for (i=0; i < p->nc_nlookups; i++) {
007e4b
diff --git a/src/getnetpath.c b/src/getnetpath.c
007e4b
index 7c19932..ea1a18c 100644
007e4b
--- a/src/getnetpath.c
007e4b
+++ b/src/getnetpath.c
007e4b
@@ -88,6 +88,7 @@ setnetpath()
007e4b
     }
007e4b
     if ((np_sessionp->nc_handlep = setnetconfig()) == NULL) {
007e4b
 	syslog (LOG_ERR, "rpc: failed to open " NETCONFIG);
007e4b
+	free(np_sessionp);
007e4b
 	return (NULL);
007e4b
     }
007e4b
     np_sessionp->valid = NP_VALID;
007e4b
diff --git a/src/rpc_generic.c b/src/rpc_generic.c
007e4b
index 589cbd5..51f36ac 100644
007e4b
--- a/src/rpc_generic.c
007e4b
+++ b/src/rpc_generic.c
007e4b
@@ -319,6 +319,7 @@ __rpc_setconf(nettype)
007e4b
 		handle->nflag = FALSE;
007e4b
 		break;
007e4b
 	default:
007e4b
+		free(handle);
007e4b
 		return (NULL);
007e4b
 	}
007e4b
 
007e4b
diff --git a/src/rpc_soc.c b/src/rpc_soc.c
007e4b
index 5a6eeb7..a85cb17 100644
007e4b
--- a/src/rpc_soc.c
007e4b
+++ b/src/rpc_soc.c
007e4b
@@ -663,15 +663,17 @@ svcunix_create(sock, sendsize, recvsize, path)
007e4b
 		    strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0)
007e4b
 			break;
007e4b
 	}
007e4b
-	if (nconf == NULL)
007e4b
+	if (nconf == NULL) {
007e4b
+		endnetconfig(localhandle);
007e4b
 		return(xprt);
007e4b
+	}
007e4b
 
007e4b
 	if ((sock = __rpc_nconf2fd(nconf)) < 0)
007e4b
 		goto done;
007e4b
 
007e4b
 	memset(&sun, 0, sizeof sun);
007e4b
 	sun.sun_family = AF_LOCAL;
007e4b
-	strncpy(sun.sun_path, path, sizeof(sun.sun_path));
007e4b
+	strncpy(sun.sun_path, path, (sizeof(sun.sun_path)-1));
007e4b
 	addrlen = sizeof(struct sockaddr_un);
007e4b
 	sa = (struct sockaddr *)&sun;
007e4b
 
007e4b
@@ -692,6 +694,8 @@ svcunix_create(sock, sendsize, recvsize, path)
007e4b
 	}
007e4b
 
007e4b
 	xprt = (SVCXPRT *)svc_tli_create(sock, nconf, &taddr, sendsize, recvsize);
007e4b
+	if (xprt == NULL)
007e4b
+		close(sock);
007e4b
 
007e4b
 done:
007e4b
 	endnetconfig(localhandle);
007e4b
diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c
007e4b
index e45736a..0c34cb7 100644
007e4b
--- a/src/rpcb_clnt.c
007e4b
+++ b/src/rpcb_clnt.c
007e4b
@@ -547,6 +547,7 @@ try_nconf:
007e4b
 		if (tmpnconf == NULL) {
007e4b
  			rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
007e4b
 			mutex_unlock(&loopnconf_lock);
007e4b
+			endnetconfig(nc_handle);
007e4b
 			return (NULL);
007e4b
 		}
007e4b
 		loopnconf = getnetconfigent(tmpnconf->nc_netid);
007e4b
diff --git a/src/rtime.c b/src/rtime.c
007e4b
index b642840..29fbf0a 100644
007e4b
--- a/src/rtime.c
007e4b
+++ b/src/rtime.c
007e4b
@@ -90,6 +90,7 @@ rtime(addrp, timep, timeout)
007e4b
 
007e4b
 	/* TCP and UDP port are the same in this case */
007e4b
 	if ((serv = getservbyname("time", "tcp")) == NULL) {
007e4b
+		do_close(s);
007e4b
 		return(-1);
007e4b
 	}
007e4b
 
007e4b
diff --git a/src/svc_generic.c b/src/svc_generic.c
007e4b
index 52a56c2..20abaa2 100644
007e4b
--- a/src/svc_generic.c
007e4b
+++ b/src/svc_generic.c
007e4b
@@ -113,6 +113,7 @@ svc_create(dispatch, prognum, versnum, nettype)
007e4b
 				if (l == NULL) {
007e4b
 					warnx("svc_create: no memory");
007e4b
 					mutex_unlock(&xprtlist_lock);
007e4b
+					__rpc_endconf(handle);
007e4b
 					return (0);
007e4b
 				}
007e4b
 				l->xprt = xprt;
007e4b
diff --git a/src/svc_simple.c b/src/svc_simple.c
007e4b
index cb58002..c32fe0a 100644
007e4b
--- a/src/svc_simple.c
007e4b
+++ b/src/svc_simple.c
007e4b
@@ -157,6 +157,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
007e4b
 				((netid = strdup(nconf->nc_netid)) == NULL)) {
007e4b
 				warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
007e4b
 				SVC_DESTROY(svcxprt);
007e4b
+				free(xdrbuf);
007e4b
 				break;
007e4b
 			}
007e4b
 			madenow = TRUE;