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
This commit is contained in:
parent
5c07adbdc3
commit
360c32cf1d
@ -74,7 +74,6 @@ help_getnext(int fd, char **topic, char **subtopic, char **desc)
|
||||
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, char **desc)
|
||||
if (*topic == NULL) {
|
||||
free(*subtopic);
|
||||
free(*desc);
|
||||
*subtopic = *desc = NULL;
|
||||
continue;
|
||||
}
|
||||
return(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user