Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()

2016-05-12 Thread Junio C Hamano
Jeff King writes: > Presumably `fclose` doesn't ever overwrite errno in practice, but I > guess it could in theory. Yeah, these two patches share the same issue. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo

Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()

2016-05-12 Thread Jeff King
On Thu, May 12, 2016 at 07:59:39AM +, Eric Wong wrote: > I think both patches in this series would benefit from capturing > errno before cleanup. `fclose` can call `free`, and `free` could > do any manner of things such as calling `madvise` with a flag > not implemented in the running kernel,

Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()

2016-05-12 Thread Eric Wong
Jeff King wrote: > On Wed, May 11, 2016 at 04:35:46PM -0700, Junio C Hamano wrote: > > +++ b/builtin/am.c > > @@ -761,9 +761,11 @@ static int split_mail_conv(mail_conv_fn fn, struct > > am_state *state, > > mail = mkpath("%s/%0*d", state->dir, state->prec, i + 1); > > > >

Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()

2016-05-11 Thread Jeff King
On Thu, May 12, 2016 at 07:23:02AM +0200, Mikael Magnusson wrote: > >> - if (!out) > >> + if (!out) { > >> + fclose(in); > >> return error(_("could not open '%s' for writing: > >> %s"), > >> ma

Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()

2016-05-11 Thread Mikael Magnusson
On Thu, May 12, 2016 at 6:47 AM, Jeff King wrote: > On Wed, May 11, 2016 at 04:35:46PM -0700, Junio C Hamano wrote: > >> Signed-off-by: Junio C Hamano >> --- >> builtin/am.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/builtin/am.c b/builtin/am.c >> index f1a84c

Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()

2016-05-11 Thread Jeff King
On Wed, May 11, 2016 at 04:35:46PM -0700, Junio C Hamano wrote: > Signed-off-by: Junio C Hamano > --- > builtin/am.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/builtin/am.c b/builtin/am.c > index f1a84c6..a373928 100644 > --- a/builtin/am.c > +++ b/builtin/am.c