mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
020d6f96e3
commit
6d68f8acf4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332560
|
@ -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…
Reference in a new issue