summaryrefslogtreecommitdiffstats
path: root/arguments.c
diff options
context:
space:
mode:
authornicm <nicm>2021-08-23 17:05:43 +0000
committernicm <nicm>2021-08-23 17:05:43 +0000
commit841ce74b4303133e0aaf379ba25cdfa7de7971b5 (patch)
treea244a3e62eab1da55023896d7650840ccf1fe7f1 /arguments.c
parent210e71edf36198e3f22525e7f548a71a5681d25c (diff)
args_make_commands_now needs to take an extra reference to the returned
command list since it will be freed already.
Diffstat (limited to 'arguments.c')
-rw-r--r--arguments.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arguments.c b/arguments.c
index 1f786529..bddb6365 100644
--- a/arguments.c
+++ b/arguments.c
@@ -127,7 +127,7 @@ args_parse(const struct args_parse *parse, struct args_value *values,
u_int count)
{
struct args *args;
- u_int i;
+ u_int i;
struct args_value *value, *new;
u_char flag, argument;
const char *found, *string, *s;
@@ -497,11 +497,13 @@ args_make_commands_now(struct cmd *self, struct cmdq_item *item, u_int idx)
state = args_make_commands_prepare(self, item, idx, NULL, 0, 0);
cmdlist = args_make_commands(state, 0, NULL, &error);
- args_make_commands_free(state);
if (cmdlist == NULL) {
cmdq_error(item, "%s", error);
free(error);
}
+ else
+ cmdlist->references++;
+ args_make_commands_free(state);
return (cmdlist);
}