summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1997-10-26 18:47:31 +0000
committerBill Paul <wpaul@FreeBSD.org>1997-10-26 18:47:31 +0000
commitacbf996600ea91c1655c7e1cebebc353f8fa40d3 (patch)
tree7b5d4a71643535dc0ffad488e30265aafe5a4f51
parentbe4ad1aa3f89ab6001224265a79ff87d0073acd5 (diff)
Notes
-rw-r--r--lib/libc/rpc/clnt_udp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c
index 035ce96fd4af..35328491c3c9 100644
--- a/lib/libc/rpc/clnt_udp.c
+++ b/lib/libc/rpc/clnt_udp.c
@@ -382,6 +382,20 @@ send_again:
} /* end of unsuccessful completion */
} /* end of valid reply message */
else {
+ /*
+ * It's possible for xdr_replymsg() to fail partway
+ * through its attempt to decode the result from the
+ * server. If this happens, it will leave the reply
+ * structure partially populated with dynamically
+ * allocated memory. (This can happen if someone uses
+ * clntudp_bufcreate() to create a CLIENT handle and
+ * specifies a receive buffer size that is too small.)
+ * This memory must be free()ed to avoid a leak.
+ */
+ int op = reply_xdrs.x_op;
+ reply_xdrs.x_op = XDR_FREE;
+ xdr_replymsg(&reply_xdrs, &reply_msg);
+ reply_xdrs.x_op = op;
cu->cu_error.re_status = RPC_CANTDECODERES;
}
if (fds != &readfds)