aboutsummaryrefslogtreecommitdiff
path: root/stand/common
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-01-23 18:01:27 +0000
committerWarner Losh <imp@FreeBSD.org>2018-01-23 18:01:27 +0000
commit74ecc44117a0163196a2b6ae88a8f6c55034f975 (patch)
tree21a45ab937ddd238950317adfbc01b4f4f0db12c /stand/common
parent1065f77afb552c656c6116cfed099c0dae2dfe0a (diff)
Notes
Diffstat (limited to 'stand/common')
-rw-r--r--stand/common/commands.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/stand/common/commands.c b/stand/common/commands.c
index def7ff284649..1d5000b55637 100644
--- a/stand/common/commands.c
+++ b/stand/common/commands.c
@@ -91,10 +91,8 @@ help_getnext(int fd, char **topic, char **subtopic, char **desc)
cp = ep;
}
if (*topic == NULL) {
- if (*subtopic != NULL)
- free(*subtopic);
- if (*desc != NULL)
- free(*desc);
+ free(*subtopic);
+ free(*desc);
continue;
}
return(1);
@@ -169,7 +167,7 @@ command_help(int argc, char *argv[])
} else if (strcmp(topic, t)) {
/* topic mismatch */
- if(matched) /* nothing more on this topic, stop scanning */
+ if (matched) /* nothing more on this topic, stop scanning */
break;
} else {
@@ -178,7 +176,7 @@ command_help(int argc, char *argv[])
if (((subtopic == NULL) && (s == NULL)) ||
((subtopic != NULL) && (s != NULL) && !strcmp(subtopic, s))) {
/* exact match, print text */
- while((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) {
+ while ((fgetstr(buf, 80, hfd) >= 0) && (buf[0] != '#')) {
if (pager_output(buf))
break;
if (pager_output("\n"))
@@ -193,24 +191,25 @@ command_help(int argc, char *argv[])
free(t);
free(s);
free(d);
+ t = s = d = NULL;
}
+ free(t);
+ free(s);
+ free(d);
pager_close();
close(hfd);
if (!matched) {
snprintf(command_errbuf, sizeof(command_errbuf),
"no help available for '%s'", topic);
free(topic);
- if (subtopic)
- free(subtopic);
+ free(subtopic);
return(CMD_ERROR);
}
free(topic);
- if (subtopic)
- free(subtopic);
+ free(subtopic);
return(CMD_OK);
}
-
COMMAND_SET(commandlist, "?", "list commands", command_commandlist);
/*