Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jan 2017 07:48:36 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312683 - head/usr.bin/mail
Message-ID:  <201701240748.v0O7man7084870@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Tue Jan 24 07:48:36 2017
New Revision: 312683
URL: https://svnweb.freebsd.org/changeset/base/312683

Log:
  Don't reference NULL pointer.
  
  MFC after:	2 weeks

Modified:
  head/usr.bin/mail/popen.c

Modified: head/usr.bin/mail/popen.c
==============================================================================
--- head/usr.bin/mail/popen.c	Tue Jan 24 05:06:52 2017	(r312682)
+++ head/usr.bin/mail/popen.c	Tue Jan 24 07:48:36 2017	(r312683)
@@ -303,7 +303,7 @@ findchild(pid_t pid, int dont_alloc)
 	    cpp = &(*cpp)->link)
 			;
 	if (*cpp == NULL) {
-	if (dont_alloc)
+		if (dont_alloc)
 			return(NULL);
 		if (child_freelist) {
 			*cpp = child_freelist;
@@ -344,6 +344,8 @@ sigchild(int signo __unused)
 	save_errno = errno;
 	while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
 		cp = findchild(pid, 1);
+		if (cp == NULL)
+			continue;
 		if (cp->free)
 			delchild(cp);
 		else {



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