Re: [PATCH v3] path.c enter_repo(): fix unproper strbuf unwrapping and memory leakage

2016-03-28 Thread 惠轶群
2016-03-29 1:58 GMT+08:00 Junio C Hamano : > Hui Yiqun writes: > >> According to strbuf.h, strbuf_detach is the sole supported method >> to unwrap a memory buffer from its strbuf shell. >> ... >> diff --git a/path.c b/path.c >> index 969b494..9801617 100644 >> --- a/path.c >> +++ b/path.c >> @@ -6

Re: [PATCH v3] path.c enter_repo(): fix unproper strbuf unwrapping and memory leakage

2016-03-28 Thread Junio C Hamano
Hui Yiqun writes: > According to strbuf.h, strbuf_detach is the sole supported method > to unwrap a memory buffer from its strbuf shell. > ... > diff --git a/path.c b/path.c > index 969b494..9801617 100644 > --- a/path.c > +++ b/path.c > @@ -625,6 +625,7 @@ const char *enter_repo(const char *path

Re: [PATCH v3] path.c enter_repo(): fix unproper strbuf unwrapping and memory leakage

2016-03-28 Thread 惠轶群
Sorry, I sent the patch repeatedly to fix a wrongly indent with space. 2016-03-28 23:57 GMT+08:00 Hui Yiqun : > According to strbuf.h, strbuf_detach is the sole supported method > to unwrap a memory buffer from its strbuf shell. > > So we should not return the pointer of strbuf.buf directly. > > W

[PATCH v3] path.c enter_repo(): fix unproper strbuf unwrapping and memory leakage

2016-03-28 Thread Hui Yiqun
According to strbuf.h, strbuf_detach is the sole supported method to unwrap a memory buffer from its strbuf shell. So we should not return the pointer of strbuf.buf directly. What's more, some memory leakages are solved. --- path.c | 15 ++- 1 file changed, 10 insertions(+), 5 deleti