Merge pull request #25226 from neovim/backport-25223-to-release-0.9

[Backport release-0.9] fix: fix use after free
This commit is contained in:
zeertzjq 2023-09-18 07:22:20 +08:00 committed by GitHub
commit cb211e5746
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,9 +253,9 @@ static int build_cmd_line(char **argv, wchar_t **cmd_line, bool is_cmdexe)
QUEUE_FOREACH(q, &args_q, {
ArgNode *arg_node = QUEUE_DATA(q, ArgNode, node);
xstrlcat(utf8_cmd_line, arg_node->arg, utf8_cmd_line_len);
QUEUE_REMOVE(q);
xfree(arg_node->arg);
xfree(arg_node);
QUEUE_REMOVE(q);
if (!QUEUE_EMPTY(&args_q)) {
xstrlcat(utf8_cmd_line, " ", utf8_cmd_line_len);
}