svn commit: r294301 - stable/9/lib/libc/rpc

Garrett Cooper ngie at FreeBSD.org
Tue Jan 19 01:33:29 UTC 2016


Author: ngie
Date: Tue Jan 19 01:33:27 2016
New Revision: 294301
URL: https://svnweb.freebsd.org/changeset/base/294301

Log:
  MFstable/10 r294300:
  
  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 at isilon.com>

Modified:
  stable/9/lib/libc/rpc/rpcb_prot.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/rpc/rpcb_prot.c
==============================================================================
--- stable/9/lib/libc/rpc/rpcb_prot.c	Tue Jan 19 01:30:22 2016	(r294300)
+++ stable/9/lib/libc/rpc/rpcb_prot.c	Tue Jan 19 01:33:27 2016	(r294301)
@@ -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;
 			/*


More information about the svn-src-stable-9 mailing list