Re: [PATCH] setup.c: reset candidate->work_tree after freeing it

2018-03-30 Thread Duy Nguyen
On Fri, Mar 30, 2018 at 8:32 PM, Junio C Hamano wrote: > Duy Nguyen writes: > >> On Fri, Mar 30, 2018 at 7:10 PM, Junio C Hamano wrote: >> >>> Which fields in candidate are safe to peek by the caller? How can a >>> caller tell? >> >> To

Re: [PATCH] setup.c: reset candidate->work_tree after freeing it

2018-03-30 Thread Junio C Hamano
Duy Nguyen writes: > On Fri, Mar 30, 2018 at 7:10 PM, Junio C Hamano wrote: > >> Which fields in candidate are safe to peek by the caller? How can a >> caller tell? > > To me, all fields should be valid after > check_repository_format_gently(). If so,

Re: [PATCH] setup.c: reset candidate->work_tree after freeing it

2018-03-30 Thread Duy Nguyen
On Fri, Mar 30, 2018 at 7:10 PM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> Dangling pointers are usually bad news. Reset it back to NULL. >> >> Signed-off-by: Nguyễn Thái Ngọc Duy >> --- > > Before abade65b ("setup:

Re: [PATCH] setup.c: reset candidate->work_tree after freeing it

2018-03-30 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > Dangling pointers are usually bad news. Reset it back to NULL. > > Signed-off-by: Nguyễn Thái Ngọc Duy > --- Before abade65b ("setup: expose enumerated repo info", 2017-11-12), candidate was an on-stack variable local to

[PATCH] setup.c: reset candidate->work_tree after freeing it

2018-03-30 Thread Nguyễn Thái Ngọc Duy
Dangling pointers are usually bad news. Reset it back to NULL. Signed-off-by: Nguyễn Thái Ngọc Duy --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.c b/setup.c index 7287779642..d193bee192 100644 --- a/setup.c +++ b/setup.c @@ -482,7