Re: [PATCH 06/26] get_mail_commit_oid(): avoid resource leak

2017-04-28 Thread Johannes Schindelin
Hi Junio & Stefan, On Wed, 26 Apr 2017, Junio C Hamano wrote: > Stefan Beller writes: > > >> - if (get_oid_hex(x, commit_id) < 0) > >> - return -1; > >> + if (!ret && get_oid_hex(x, commit_id) < 0) > >> + ret = -1; > >> > > > > In

Re: [PATCH 06/26] get_mail_commit_oid(): avoid resource leak

2017-04-28 Thread Johannes Schindelin
Hi Hannes, On Thu, 27 Apr 2017, Johannes Sixt wrote: > Am 26.04.2017 um 22:19 schrieb Johannes Schindelin: > > > > diff --git a/builtin/am.c b/builtin/am.c > > index 805f56cec2f..01b700e5e74 100644 > > --- a/builtin/am.c > > +++ b/builtin/am.c > > @@ -1359,15 +1359,16 @@ static int

Re: [PATCH 06/26] get_mail_commit_oid(): avoid resource leak

2017-04-27 Thread Johannes Sixt
Am 26.04.2017 um 22:19 schrieb Johannes Schindelin: When we fail to read, or parse, the file, we still want to close the file descriptor and release the strbuf. Reported via Coverity. Signed-off-by: Johannes Schindelin --- builtin/am.c | 11 ++- 1 file

Re: [PATCH 06/26] get_mail_commit_oid(): avoid resource leak

2017-04-26 Thread Junio C Hamano
Stefan Beller writes: >> - if (get_oid_hex(x, commit_id) < 0) >> - return -1; >> + if (!ret && get_oid_hex(x, commit_id) < 0) >> + ret = -1; >> > > In similar cases of fixing mem leaks, we'd put a label here > and make excessive use of

Re: [PATCH 06/26] get_mail_commit_oid(): avoid resource leak

2017-04-26 Thread Stefan Beller
On Wed, Apr 26, 2017 at 1:19 PM, Johannes Schindelin wrote: > When we fail to read, or parse, the file, we still want to close the file > descriptor and release the strbuf. > > Reported via Coverity. > > Signed-off-by: Johannes Schindelin >

[PATCH 06/26] get_mail_commit_oid(): avoid resource leak

2017-04-26 Thread Johannes Schindelin
When we fail to read, or parse, the file, we still want to close the file descriptor and release the strbuf. Reported via Coverity. Signed-off-by: Johannes Schindelin --- builtin/am.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git