svn commit: r301622 - stable/10/lib/libc/rpc
Garrett Cooper
ngie at FreeBSD.org
Wed Jun 8 13:58:48 UTC 2016
Author: ngie
Date: Wed Jun 8 13:58:47 2016
New Revision: 301622
URL: https://svnweb.freebsd.org/changeset/base/301622
Log:
MFC r300620,r300621:
r300620:
Use reallocf instead of malloc to fix leak with outbuf_pmap
The previous code overwrote outbuf_pmap's memory with malloc once per
loop iteration, which leaked its memory; use reallocf instead to ensure
that memory is properly free'd each loop iteration.
Add a outbuf_pmap = NULL in the failure case to avoid a double-free
at the bottom of the function.
CID: 1038776
r300621:
Remove redundant NULLing of outbuf_pmap
If reallocf ever failed, outbuf_pmap would already be NULL
Modified:
stable/10/lib/libc/rpc/clnt_bcast.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/lib/libc/rpc/clnt_bcast.c
==============================================================================
--- stable/10/lib/libc/rpc/clnt_bcast.c Wed Jun 8 13:57:18 2016 (r301621)
+++ stable/10/lib/libc/rpc/clnt_bcast.c Wed Jun 8 13:58:47 2016 (r301622)
@@ -341,7 +341,8 @@ rpc_broadcast_exp(prog, vers, proc, xarg
#ifdef PORTMAP
if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) {
udpbufsz = fdlist[fdlistno].dsize;
- if ((outbuf_pmap = malloc(udpbufsz)) == NULL) {
+ outbuf_pmap = reallocf(outbuf_pmap, udpbufsz);
+ if (outbuf_pmap == NULL) {
_close(fd);
stat = RPC_SYSTEMERROR;
goto done_broad;
More information about the svn-src-stable-10
mailing list