Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2019 18:32:05 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r344285 - stable/11/stand/common
Message-ID:  <201902191832.x1JIW5O6020800@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Feb 19 18:32:05 2019
New Revision: 344285
URL: https://svnweb.freebsd.org/changeset/base/344285

Log:
  MFC r332555: loader: provide values in help_getnext()
  
  With r328289 we attempt to make sure we free the resources allocated in
  help_getnext(), however, it is possible that we get no resources allocated
  and help_getnext() will return early.
  
  Make sure we have pointers set to NULL early in help_getnext().

Modified:
  stable/11/stand/common/commands.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/stand/common/commands.c
==============================================================================
--- stable/11/stand/common/commands.c	Tue Feb 19 18:30:37 2019	(r344284)
+++ stable/11/stand/common/commands.c	Tue Feb 19 18:32:05 2019	(r344285)
@@ -64,7 +64,9 @@ static int
 help_getnext(int fd, char **topic, char **subtopic, char **desc) 
 {
     char	line[81], *cp, *ep;
-    
+
+    /* Make sure we provide sane values. */
+    *topic = *subtopic = *desc = NULL;
     for (;;) {
 	if (fgetstr(line, 80, fd) < 0)
 	    return(0);



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