Blame SOURCES/rpcbind-0.2.0-memleaks.patch

3da827
diff -up rpcbind-0.2.0/src/pmap_svc.c.orig rpcbind-0.2.0/src/pmap_svc.c
3da827
--- rpcbind-0.2.0/src/pmap_svc.c.orig	2017-05-11 13:15:17.199851080 -0400
3da827
+++ rpcbind-0.2.0/src/pmap_svc.c	2017-05-11 13:15:58.573156590 -0400
3da827
@@ -175,6 +175,7 @@ pmapproc_change(struct svc_req *rqstp /*
3da827
 	long ans;
3da827
 	uid_t uid;
3da827
 	char uidbuf[32];
3da827
+	int rc = TRUE;
3da827
 
3da827
 	/*
3da827
 	 * Can't use getpwnam here. We might end up calling ourselves
3da827
@@ -194,7 +195,8 @@ pmapproc_change(struct svc_req *rqstp /*
3da827
 
3da827
 	if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
3da827
 		svcerr_decode(xprt);
3da827
-		return (FALSE);
3da827
+		rc = FALSE;
3da827
+		goto done;
3da827
 	}
3da827
 #ifdef RPCBIND_DEBUG
3da827
 	if (debugging)
3da827
@@ -205,7 +207,8 @@ pmapproc_change(struct svc_req *rqstp /*
3da827
 
3da827
 	if (!check_access(xprt, op, reg.pm_prog, PMAPVERS)) {
3da827
 		svcerr_weakauth(xprt);
3da827
-		return (FALSE);
3da827
+		rc = (FALSE);
3da827
+		goto done;
3da827
 	}
3da827
 
3da827
 	rpcbreg.r_prog = reg.pm_prog;
3da827
@@ -258,7 +261,16 @@ done_change:
3da827
 		rpcbs_set(RPCBVERS_2_STAT, ans);
3da827
 	else
3da827
 		rpcbs_unset(RPCBVERS_2_STAT, ans);
3da827
-	return (TRUE);
3da827
+done:
3da827
+	if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
3da827
+		if (debugging) {
3da827
+			(void) xlog(LOG_DEBUG, "unable to free arguments\n");
3da827
+			if (doabort) {
3da827
+				rpcbind_abort();
3da827
+			}
3da827
+		}
3da827
+	}
3da827
+	return (rc);
3da827
 }
3da827
 
3da827
 /* ARGSUSED */
3da827
@@ -272,15 +284,18 @@ pmapproc_getport(struct svc_req *rqstp /
3da827
 #ifdef RPCBIND_DEBUG
3da827
 	char *uaddr;
3da827
 #endif
3da827
+	int rc = TRUE;
3da827
 
3da827
 	if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
3da827
 		svcerr_decode(xprt);
3da827
-		return (FALSE);
3da827
+		rc = FALSE;
3da827
+		goto done;
3da827
 	}
3da827
 
3da827
 	if (!check_access(xprt, PMAPPROC_GETPORT, reg.pm_prog, PMAPVERS)) {
3da827
 		svcerr_weakauth(xprt);
3da827
-		return FALSE;
3da827
+		rc = FALSE;
3da827
+		goto done;
3da827
 	}
3da827
 
3da827
 #ifdef RPCBIND_DEBUG
3da827
@@ -330,21 +345,34 @@ pmapproc_getport(struct svc_req *rqstp /
3da827
 		pmap_ipprot2netid(reg.pm_prot) ?: "<unknown>",
3da827
 		port ? udptrans : "");
3da827
 
3da827
-	return (TRUE);
3da827
+done:
3da827
+	if (!svc_freeargs(xprt, (xdrproc_t) xdr_pmap, (char *)&reg)) {
3da827
+		if (debugging) {
3da827
+			(void) xlog(LOG_DEBUG, "unable to free arguments\n");
3da827
+			if (doabort) {
3da827
+				rpcbind_abort();
3da827
+			}
3da827
+		}
3da827
+	}
3da827
+	return (rc);
3da827
 }
3da827
 
3da827
 /* ARGSUSED */
3da827
 static bool_t
3da827
 pmapproc_dump(struct svc_req *rqstp /*__unused*/, SVCXPRT *xprt)
3da827
 {
3da827
+	int rc = TRUE;
3da827
+
3da827
 	if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL)) {
3da827
 		svcerr_decode(xprt);
3da827
-		return (FALSE);
3da827
+		rc = FALSE;
3da827
+		goto done;
3da827
 	}
3da827
 
3da827
 	if (!check_access(xprt, PMAPPROC_DUMP, 0, PMAPVERS)) {
3da827
 		svcerr_weakauth(xprt);
3da827
-		return FALSE;
3da827
+		rc = FALSE;
3da827
+		goto done;
3da827
 	}
3da827
 	
3da827
 	if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist_ptr,
3da827
@@ -354,7 +382,17 @@ pmapproc_dump(struct svc_req *rqstp /*__
3da827
 			rpcbind_abort();
3da827
 		}
3da827
 	}
3da827
-	return (TRUE);
3da827
+
3da827
+done:
3da827
+	if (!svc_freeargs(xprt, (xdrproc_t) xdr_void, (char *)NULL)) {
3da827
+		if (debugging) {
3da827
+			(void) xlog(LOG_DEBUG, "unable to free arguments\n");
3da827
+			if (doabort) {
3da827
+				rpcbind_abort();
3da827
+			}
3da827
+		}
3da827
+	}
3da827
+	return (rc);
3da827
 }
3da827
 
3da827
 int pmap_netid2ipprot(const char *netid)
3da827
diff -up rpcbind-0.2.0/src/rpcb_svc_4.c.orig rpcbind-0.2.0/src/rpcb_svc_4.c
3da827
--- rpcbind-0.2.0/src/rpcb_svc_4.c.orig	2017-05-11 13:15:17.199851080 -0400
3da827
+++ rpcbind-0.2.0/src/rpcb_svc_4.c	2017-05-11 13:15:58.574156573 -0400
3da827
@@ -219,7 +219,7 @@ rpcb_service_4(struct svc_req *rqstp, SV
3da827
 		svcerr_decode(transp);
3da827
 		if (debugging)
3da827
 			(void) xlog(LOG_DEBUG, "rpcbind: could not decode\n");
3da827
-		return;
3da827
+		goto done;
3da827
 	}
3da827
 
3da827
 	if (rqstp->rq_proc == RPCBPROC_SET
3da827
diff -up rpcbind-0.2.0/src/rpcb_svc_com.c.orig rpcbind-0.2.0/src/rpcb_svc_com.c
3da827
--- rpcbind-0.2.0/src/rpcb_svc_com.c.orig	2017-05-11 13:15:17.203851012 -0400
3da827
+++ rpcbind-0.2.0/src/rpcb_svc_com.c	2017-05-11 13:18:58.197141434 -0400
3da827
@@ -62,6 +62,7 @@
3da827
 #include <stdlib.h>
3da827
 
3da827
 #include "rpcbind.h"
3da827
+#include "xlog.h"
3da827
 
3da827
 #define RPC_BUF_MAX	65536	/* can be raised if required */
3da827
 
3da827
@@ -930,6 +931,14 @@ error:
3da827
 	if (call_msg.rm_xid != 0)
3da827
 		(void) free_slot_by_xid(call_msg.rm_xid);
3da827
 out:
3da827
+	if (!svc_freeargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) {
3da827
+		if (debugging) {
3da827
+			(void) xlog(LOG_DEBUG, "unable to free arguments\n");
3da827
+			if (doabort) {
3da827
+				rpcbind_abort();
3da827
+			}
3da827
+		}
3da827
+	}
3da827
 	if (local_uaddr)
3da827
 		free(local_uaddr);
3da827
 	if (buf_alloc)
3da827
diff -up rpcbind-0.2.0/src/rpcb_svc.c.orig rpcbind-0.2.0/src/rpcb_svc.c
3da827
--- rpcbind-0.2.0/src/rpcb_svc.c.orig	2017-05-11 13:15:17.199851080 -0400
3da827
+++ rpcbind-0.2.0/src/rpcb_svc.c	2017-05-11 13:15:58.573156590 -0400
3da827
@@ -165,7 +165,7 @@ rpcb_service_3(struct svc_req *rqstp, SV
3da827
 		svcerr_decode(transp);
3da827
 		if (debugging)
3da827
 			(void) xlog(LOG_DEBUG, "rpcbind: could not decode");
3da827
-		return;
3da827
+		goto done;
3da827
 	}
3da827
 
3da827
 	if (rqstp->rq_proc == RPCBPROC_SET