From 5fb3f2afade73fce4fd970f3cc96843925f73b3e Mon Sep 17 00:00:00 2001 From: mbr Date: Sat, 9 Sep 2006 22:29:16 +0000 Subject: Sync with NetBSD rev. 1.6 + 1.7 Coverity CID 779 + 780: Avoid NULL pointer dereference. MFC after: 1 month --- lib/libc/rpc/rpcb_prot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/rpc/rpcb_prot.c b/lib/libc/rpc/rpcb_prot.c index 17dc375..5c199d8 100644 --- a/lib/libc/rpc/rpcb_prot.c +++ b/lib/libc/rpc/rpcb_prot.c @@ -129,7 +129,7 @@ xdr_rpcblist_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_next; if (! xdr_reference(xdrs, (caddr_t *)rp, (u_int)sizeof (rpcblist), (xdrproc_t)xdr_rpcb)) { @@ -143,7 +143,7 @@ xdr_rpcblist_ptr(xdrs, rp) * gets nulled out by the xdr_reference * but next itself survives. */ - } else { + } else if (*rp) { rp = &((*rp)->rpcb_next); } } @@ -225,7 +225,7 @@ xdr_rpcb_entry_list_ptr(xdrs, rp) (xdrproc_t)xdr_rpcb_entry)) { return (FALSE); } - if (freeing) { + if (freeing && *rp) { next_copy = next; rp = &next_copy; /* @@ -233,7 +233,7 @@ xdr_rpcb_entry_list_ptr(xdrs, rp) * gets nulled out by the xdr_reference * but next itself survives. */ - } else { + } else if (*rp) { rp = &((*rp)->rpcb_entry_next); } } -- cgit v1.1