diff --git a/arguments.c b/arguments.c index ad3d699d..4b08de2c 100644 --- a/arguments.c +++ b/arguments.c @@ -153,6 +153,10 @@ args_parse(const struct args_parse *parse, struct args_value *values, flag = *string++; if (flag == '\0') break; + if (flag == '?') { + args_free(args); + return (NULL); + } if (!isalnum(flag)) { xasprintf(cause, "invalid flag -%c", flag); args_free(args); diff --git a/cmd.c b/cmd.c index 44952d11..f8027dfe 100644 --- a/cmd.c +++ b/cmd.c @@ -501,7 +501,7 @@ cmd_parse(struct args_value *values, u_int count, const char *file, u_int line, const struct cmd_entry *entry; struct cmd *cmd; struct args *args; - char *error; + char *error = NULL; if (count == 0 || values[0].type != ARGS_STRING) { xasprintf(cause, "no command");