Merge pull request #19 from dang/coverity

Remove old sleep triggering Coverity errors
diff --git a/src/clnt_vc.c b/src/clnt_vc.c
index 174e7e2..57f2b23 100644
--- a/src/clnt_vc.c
+++ b/src/clnt_vc.c
@@ -312,7 +312,7 @@
 		if (ct->ct_addr.len)
 			mem_free(ct->ct_addr.buf, ct->ct_addr.len);
 
-		if (xd->refcnt == 1) {
+		if (xd->refcnt == 0) {
 			XDR_DESTROY(&xd->shared.xdrs_in);
 			XDR_DESTROY(&xd->shared.xdrs_out);
 			free_x_vc_data(xd);
diff --git a/src/rpc_dplx.c b/src/rpc_dplx.c
index bf93e27..45df04c 100644
--- a/src/rpc_dplx.c
+++ b/src/rpc_dplx.c
@@ -201,10 +201,8 @@
 static inline struct rpc_dplx_rec *
 alloc_dplx_rec(void)
 {
-	struct rpc_dplx_rec *rec = mem_alloc(sizeof(struct rpc_dplx_rec));
+	struct rpc_dplx_rec *rec = mem_zalloc(sizeof(struct rpc_dplx_rec));
 
-	rec->refcnt = 0;
-	rec->hdl.xprt = NULL;
 	mutex_init(&rec->locktrace.mtx, NULL);
 	/* send channel */
 	rpc_dplx_lock_init(&rec->send.lock);
diff --git a/src/svc_vc.c b/src/svc_vc.c
index cabd325..e5071c1 100644
--- a/src/svc_vc.c
+++ b/src/svc_vc.c
@@ -658,10 +658,13 @@
 	mem_free(rdvs, sizeof(struct cf_rendezvous));
 	mem_free(xprt, sizeof(SVCXPRT));
 
-	refcnt = rpc_dplx_unref(rec,
-				RPC_DPLX_FLAG_LOCKED | RPC_DPLX_FLAG_UNLOCK);
-	if (!refcnt)
-		mem_free(xd, sizeof(struct x_vc_data));
+	(void)rpc_dplx_unref(rec, RPC_DPLX_FLAG_LOCKED | RPC_DPLX_FLAG_UNLOCK);
+
+	if (xd->refcnt == 0) {
+		XDR_DESTROY(&xd->shared.xdrs_in);
+		XDR_DESTROY(&xd->shared.xdrs_out);
+		free_x_vc_data(xd);
+	}
 }
 
 static void