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

Fix another file leak

From
CWChris Wilson <cwilson@vigilantsw.com>
Date
Oct 7, 2011, 01:41 UTC
Message-ID
<20111007014136.GB10839@localhost>
Hi,

Vigilant Sentry (our C/C++ static analysis tool) found that commit 6d4bb383, added a file leak to builtin/fetch.c.

static int store_updated_refs(...
{  
    FILE *fp;
    ...
    fp = fopen(filename, "a");
    if (!fp)
        return error(_("cannot open %s: %s\n"), filename, strerror(errno));
    ....
    if (check_everything_connected(iterate_ref_map, 0, &rm))
        return error(_("%s did not send all necessary objects\n"), url);
Please close the file handle before returning from the function.

Thanks, Chris

-- 
Chris Wilson
http://vigilantsw.com/
Vigilant Software, LLC
Next: René Scharfe
Message 1 of 5 in “Fix another file leak”
  1. Chris WilsonOct 7, 2011
  2. fetch: plug two leaks on error exit in store_updated_refsRené Scharfe, Oct 7, 2011
  3. Tay Ray ChuanOct 7, 2011
  4. René ScharfeOct 7, 2011
  5. fetch: plug two leaks on error exit in store_updated_refsTay Ray Chuan, Oct 7, 2011

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.