Blame SOURCES/rpcbind-0.2.0-memleaks.patch

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