Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2016 01:33:28 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r294301 - stable/9/lib/libc/rpc
Message-ID:  <201601190133.u0J1XSlY084385@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;
 			/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601190133.u0J1XSlY084385>