Re: [PATCH 3/3] sub-process: allocate argv on the heap

2017-10-04 Thread Thomas Gummerer
On 10/04, Junio C Hamano wrote: > Johannes Sixt writes: > > > 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

Re: [PATCH 3/3] sub-process: allocate argv on the heap

2017-10-03 Thread Johannes Sixt
Am 04.10.2017 um 06:59 schrieb Junio C Hamano: Johannes Sixt writes: 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

Re: [PATCH 3/3] sub-process: allocate argv on the heap

2017-10-03 Thread Jeff King
On Wed, Oct 04, 2017 at 01:59:31PM +0900, Junio C Hamano wrote: > > Perhaps this should become > > > > argv_array_push(>args, cmd); > > > > so that there is no new memory leak? > > Sounds like a good idea (if I am not grossly mistaken as to what is > being suggested). > > Here is what I am

Re: [PATCH 3/3] sub-process: allocate argv on the heap

2017-10-03 Thread Junio C Hamano
Johannes Sixt writes: > 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 >>

Re: [PATCH 3/3] sub-process: allocate argv on the heap

2017-10-03 Thread Stefan Beller
On Tue, Oct 3, 2017 at 12:57 PM, Thomas Gummerer wrote: > Currently the argv is only allocated on the stack, and then assigned to > process->argv. When the start_subprocess function goes out of scope, > the local argv variable is eliminated from the stack, but the pointer

Re: [PATCH 3/3] sub-process: allocate argv on the heap

2017-10-03 Thread Johannes Sixt
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;

[PATCH 3/3] sub-process: allocate argv on the heap

2017-10-03 Thread Thomas Gummerer
Currently the argv is only allocated on the stack, and then assigned to process->argv. When the start_subprocess function goes out of scope, the local argv variable is eliminated from the stack, but the pointer is still kept around in process->argv. Much later when we try to access the same