git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jeff King <peff@peff.net>
Date
May 12, 2016, 08:03 UTC
Message-ID
<20160512080331.GA18874@sigill.intra.peff.net>
In-Reply-To
<20160512075939.GA31343@dcvr.yhbt.net>
On Thu, May 12, 2016 at 07:59:39AM +0000, Eric Wong wrote:
Show 10 quoted lines
> 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
Previous: Eric WongNext: Junio C Hamano
Message 7 of 8 in “am: plug small memory leak when split_mail_stgit_series() fails”
  1. 1/2 am: plug small memory leak when split_mail_stgit_series() failsJunio C Hamano, May 11, 2016
  2. 2/2 am: plug FILE * leak in split_mail_conv()Junio C Hamano, May 11, 2016
  3. Jeff KingMay 12, 2016
  4. Mikael MagnussonMay 12, 2016
  5. Jeff KingMay 12, 2016
  6. Eric WongMay 12, 2016
  7. Jeff KingMay 12, 2016
  8. Junio C HamanoMay 12, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.