From: Ronnie Sahlberg Date: Sat, 2 Jul 2011 02:16:37 +0000 (+1000) Subject: With broadcast PDUs we can receive multiple replies so must make sure we X-Git-Tag: upstream/1.9.6^2~356 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1b9917b8866a74edf06b80668e44ed0e593a47b9;p=deb_libnfs.git With broadcast PDUs we can receive multiple replies so must make sure we delete the previuous unmarshalling buffer when we start over and process the second pdu to the initial call. Or else we will leak memory very slowly when processing broadcast RPC replies --- diff --git a/lib/pdu.c b/lib/pdu.c index 601f110..d6e8232 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -149,6 +149,9 @@ static int rpc_process_reply(struct rpc_context *rpc, struct rpc_pdu *pdu, XDR * bzero(&msg, sizeof(struct rpc_msg)); msg.acpted_rply.ar_verf = _null_auth; if (pdu->xdr_decode_bufsize > 0) { + if (pdu->xdr_decode_buf != NULL) { + free(pdu->xdr_decode_buf); + } pdu->xdr_decode_buf = malloc(pdu->xdr_decode_bufsize); if (pdu->xdr_decode_buf == NULL) { rpc_set_error(rpc, "xdr_replymsg failed in portmap_getport_reply");