From 1b9917b8866a74edf06b80668e44ed0e593a47b9 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 2 Jul 2011 12:16:37 +1000 Subject: [PATCH] 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 --- lib/pdu.c | 3 +++ 1 file changed, 3 insertions(+) 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"); -- 2.34.1