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

Re: [PATCH] Fix resource leaks in wrapper.c

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 27, 2009, 08:26 UTC
Message-ID
<4AE6AEC8.4040800@drmicha.warpmail.net>
In-Reply-To
<4AE69DA7.6030704@viscovery.net>
Johannes Sixt venit, vidit, dixit 27.10.2009 08:13:
Show 12 quoted lines
> Laszlo Papp schrieb:
>> @@ -266,7 +266,7 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern)
>>  	fd = mkstemp(template);
>>  	if (0 <= fd)
>>  		return fd;
>> -
>> +	close(fd);
> 
> Sorry, where is here a resource leak? You are "closing" something that was
> never opened because fd is less than zero.
> 
> Ditto for the other case.

I guess it's about silencing some challenged code analysis tool. I recall that last time we had something like this we decided that coders are smarter than tools... and also that clean up like this (for real leaks) would be something for libgit.

Michael
Previous: Johannes SixtNext: Michael J Gruber
Message 3 of 4 in “Fix resource leaks in wrapper.c”
  1. Fix resource leaks in wrapper.cLaszlo Papp, Oct 27, 2009
  2. Johannes SixtOct 27, 2009
  3. Michael J GruberOct 27, 2009
  4. Michael J GruberOct 27, 2009

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.