Sync with NetBSD rev. 1.6 + 1.7

Coverity CID 779 + 780: Avoid NULL pointer dereference.

MFC after:    1 month
This commit is contained in:
mbr 2006-09-09 22:29:16 +00:00
parent f5fc251a25
commit 5fb3f2afad

View File

@ -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);
}
}