Author: tsoome
Date: Mon Apr 16 12:46:14 2018
New Revision: 332560
URL: https://svnweb.freebsd.org/changeset/base/332560

Log:
  loader: make sure we do not return garbage from help_getnext
  
  Since we do free subtopic and desc in help_getnext(), we need to set them also
  NULL, so we make sure we dont get double free().
  
  Approved by:  bapt
  Differential Revision:        https://reviews.freebsd.org/D15082

Modified:
  head/stand/common/commands.c

Modified: head/stand/common/commands.c
==============================================================================
--- head/stand/common/commands.c        Mon Apr 16 09:17:36 2018        
(r332559)
+++ head/stand/common/commands.c        Mon Apr 16 12:46:14 2018        
(r332560)
@@ -74,7 +74,6 @@ help_getnext(int fd, char **topic, char **subtopic, ch
        if ((strlen(line) < 3) || (line[0] != '#') || (line[1] != ' '))
            continue;
 
-       *topic = *subtopic = *desc = NULL;
        cp = line + 2;
        while((cp != NULL) && (*cp != 0)) {
            ep = strchr(cp, ' ');
@@ -95,6 +94,7 @@ help_getnext(int fd, char **topic, char **subtopic, ch
        if (*topic == NULL) {
            free(*subtopic);
            free(*desc);
+           *subtopic = *desc = NULL;
            continue;
        }
        return(1);
_______________________________________________
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