From 2111142cf1715eeac174cd5c71ed90f00595b17e Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 25 Oct 2022 09:12:05 +0000 Subject: [PATCH] Fix a memory leak, from Japin Li in GitHub issue 3358. --- cmd-parse.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd-parse.y b/cmd-parse.y index 1d692770..cdf026f3 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -1086,7 +1086,8 @@ cmd_parse_from_arguments(struct args_value *values, u_int count, arg->type = CMD_PARSE_STRING; arg->string = copy; TAILQ_INSERT_TAIL(&cmd->arguments, arg, entry); - } + } else + free(copy); } else if (values[i].type == ARGS_COMMANDS) { arg = xcalloc(1, sizeof *arg); arg->type = CMD_PARSE_PARSED_COMMANDS;