From: Johannes Sixt Date: Tue, 03 Oct 2017 20:24:57 GMT Subject: Re: [PATCH 3/3] sub-process: allocate argv on the heap Message-ID: <85456f81-9e9f-d0e4-86f7-9f546691dee3@kdbg.org> In-Reply-To: <20171003195713.13395-4-t.gummerer@gmail.com> Am 03.10.2017 um 21:57 schrieb Thomas Gummerer: > diff --git a/sub-process.c b/sub-process.c > index 6dde5062be..4680af8193 100644 > --- a/sub-process.c > +++ b/sub-process.c > @@ -77,7 +77,9 @@ int subprocess_start(struct hashmap *hashmap, struct subprocess_entry *entry, co > { > int err; > struct child_process *process; > - const char *argv[] = { cmd, NULL }; > + const char **argv = xmalloc(2 * sizeof(char *)); > + argv[0] = cmd; > + argv[1] = NULL; > > entry->cmd = cmd; > process = &entry->process; > Perhaps this should become argv_array_push(&process->args, cmd); so that there is no new memory leak? -- Hannes