On Thu, Apr 06, 2017 at 10:02:45AM +0200, Martin Liška wrote: > Subject: [PATCH 2/2] Fix stack-use-after-scope error reported by ASAN by GCC > 7. > > The use-after-scope is triggered here: > READ of size 8 at 0x7ffc4f674e20 thread T0 > #0 0x6f0b69 in finish_command /home/marxin/Programming/git/run-command.c:570 > #1 0x5b6101 in kill_multi_file_filter /home/marxin/Programming/git/convert.c:570 > #2 0x5b798a in kill_multi_file_filter /home/marxin/Programming/git/convert.c:770 Yeah, this is definitely a problem. Your fix works, but... > @@ -600,7 +601,8 @@ static struct cmd2process *start_multi_file_filter(struct hashmap *hashmap, cons > process = &entry->process; > > child_process_init(process); > - process->argv = argv; > + process->argv = xcalloc(2, sizeof(const char *)); > + process->argv[0] = cmd; > process->use_shell = 1; > process->in = -1; > process->out = -1; We can just do: argv_array_push(&process->args, cmd); here. And then it is freed automatically when finish_command() is called (and also if start_command never starts the process, which I think your patch misses). -Peff