Coverity CID 780: Avoid NULL pointer deref.

This commit is contained in:
christos 2006-03-19 02:37:59 +00:00
parent 58a505fcfe
commit d06c1d3e9d
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpcb_prot.c,v 1.6 2005/06/01 05:46:35 lukem Exp $ */
/* $NetBSD: rpcb_prot.c,v 1.7 2006/03/19 02:37:59 christos Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)rpcb_prot.c 1.9 89/04/21 Copyr 1984 Sun Micro";
#else
__RCSID("$NetBSD: rpcb_prot.c,v 1.6 2005/06/01 05:46:35 lukem Exp $");
__RCSID("$NetBSD: rpcb_prot.c,v 1.7 2006/03/19 02:37:59 christos Exp $");
#endif
#endif
@ -154,7 +154,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)) {
@ -168,7 +168,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);
}
}