fix: fix use after free

(cherry picked from commit 8a0eb90e14)
This commit is contained in:
sid-6581 2023-09-17 13:47:55 -05:00 committed by github-actions[bot]
parent 26c6d78a0c
commit 28f600337f

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);
}