summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormbr <mbr@FreeBSD.org>2006-09-09 22:29:16 +0000
committermbr <mbr@FreeBSD.org>2006-09-09 22:29:16 +0000
commit5fb3f2afade73fce4fd970f3cc96843925f73b3e (patch)
tree3c31f5b6320b28dfcd778c37fb7a7149a25317f8 /lib
parentf5fc251a2597d700a49e766ac864f1c40aebf56c (diff)
downloadFreeBSD-src-5fb3f2afade73fce4fd970f3cc96843925f73b3e.zip
FreeBSD-src-5fb3f2afade73fce4fd970f3cc96843925f73b3e.tar.gz
Sync with NetBSD rev. 1.6 + 1.7
Coverity CID 779 + 780: Avoid NULL pointer dereference. MFC after: 1 month
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/rpc/rpcb_prot.c8
1 files changed, 4 insertions, 4 deletions
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);
}
}
OpenPOWER on IntegriCloud