summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-01-19 01:30:22 +0000
committerngie <ngie@FreeBSD.org>2016-01-19 01:30:22 +0000
commit95e3008df9dacdefc14557f98920587b391f3b2b (patch)
treef444b2fb24439745d8d9f59f90944f702d4d9943 /lib
parentba5e3d1893b95370388c1a13b9179ab7a051b4fd (diff)
downloadFreeBSD-src-95e3008df9dacdefc14557f98920587b391f3b2b.zip
FreeBSD-src-95e3008df9dacdefc14557f98920587b391f3b2b.tar.gz
MFC r293715:
Fix a mismerge from NetBSD in r162194 with `xdr_rpcb_entry_list_ptr(..)` This fixes the potential NULL pointer dereference properly, and also fixes memory leaks encountered in the process of iterating through `*rp`. Found by: Valgrind Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/rpcb_prot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/rpc/rpcb_prot.c b/lib/libc/rpc/rpcb_prot.c
index f543aaf..92463c0 100644
--- a/lib/libc/rpc/rpcb_prot.c
+++ b/lib/libc/rpc/rpcb_prot.c
@@ -217,14 +217,14 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
* the case of freeing we must remember the next object
* before we free the current object ...
*/
- if (freeing)
+ if (freeing && *rp)
next = (*rp)->rpcb_entry_next;
if (! xdr_reference(xdrs, (caddr_t *)rp,
(u_int)sizeof (rpcb_entry_list),
(xdrproc_t)xdr_rpcb_entry)) {
return (FALSE);
}
- if (freeing && *rp) {
+ if (freeing) {
next_copy = next;
rp = &next_copy;
/*
OpenPOWER on IntegriCloud