Author: ngie
Date: Tue Jan 19 01:30:22 2016
New Revision: 294300
URL: https://svnweb.freebsd.org/changeset/base/294300

Log:
  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.ohlr...@isilon.com>

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

Modified: stable/10/lib/libc/rpc/rpcb_prot.c
==============================================================================
--- stable/10/lib/libc/rpc/rpcb_prot.c  Mon Jan 18 22:21:46 2016        
(r294299)
+++ stable/10/lib/libc/rpc/rpcb_prot.c  Tue Jan 19 01:30:22 2016        
(r294300)
@@ -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;
                        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to