Author: tsoome
Date: Mon Apr 16 07:26:23 2018
New Revision: 332555
URL: https://svnweb.freebsd.org/changeset/base/332555

Log:
  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().
  
  Reported by:  Andy Fiddaman

Modified:
  head/stand/common/commands.c

Modified: head/stand/common/commands.c
==============================================================================
--- head/stand/common/commands.c        Mon Apr 16 04:16:46 2018        
(r332554)
+++ head/stand/common/commands.c        Mon Apr 16 07:26:23 2018        
(r332555)
@@ -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);
_______________________________________________
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