git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Eric Wong <e@80x24.org>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] am: plug FILE * leak in split_mail_conv()
Date: Thu, 12 May 2016 04:03:31 -0400	[thread overview]
Message-ID: <20160512080331.GA18874@sigill.intra.peff.net> (raw)
In-Reply-To: <20160512075939.GA31343@dcvr.yhbt.net>

On Thu, May 12, 2016 at 07:59:39AM +0000, 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, or failing an optional
> trylock without being fatal.
> 
> There's lots of non-standard malloc implementations out there :)
> 
> So I'm not sure if there's ever a guarantee that a non-error
> function call preserves `errno`.

Good point. This came up not too long ago in:

  http://article.gmane.org/gmane.comp.version-control.git/286460

I believe POSIX does say that non-error calls should preserve errno, but
all the world is not POSIX. And a future POSIX will mandate that `free`
should not touch errno, but it's not the future yet (and also, all the
world's not POSIX).

-Peff

  reply	other threads:[~2016-05-12  8:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 23:35 [PATCH 1/2] am: plug small memory leak when split_mail_stgit_series() fails Junio C Hamano
2016-05-11 23:35 ` [PATCH 2/2] am: plug FILE * leak in split_mail_conv() Junio C Hamano
2016-05-12  4:47   ` Jeff King
2016-05-12  5:23     ` Mikael Magnusson
2016-05-12  5:29       ` Jeff King
2016-05-12  7:59     ` Eric Wong
2016-05-12  8:03       ` Jeff King [this message]
2016-05-12 15:59     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160512080331.GA18874@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).