svn commit: r332560 - head/stand/common
Toomas Soome
tsoome at FreeBSD.org
Mon Apr 16 12:46:15 UTC 2018
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);
More information about the svn-src-head
mailing list