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

found a resource leak in file builtin-fast-export.c

From
MEMartin Ettl <ettl.martin@gmx.de>
Date
Jul 9, 2009, 07:57 UTC
Message-ID
<20090709075728.137880@gmx.net>
Hi,
i have checked the source base of git with the static code analyis tool cppcheck. It brougt up an issue in file 1.6.3.3/builtin-fast-export.c at line 447.
The tool printed the following waring:
[git-1.6.3.3/builtin-fast-export.c:447]: (error) Resource leak: f
I have attached a patch to resolve this.
Best regards
Ettl Martin
-- 
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02


--- git-1.6.3.3/builtin-fast-export.c	2009-06-22 08:24:25.000000000 +0200
+++ git-1.6.3.3/builtin-fast-export_new.c	2009-07-09 09:44:28.000000000 +0200
@@ -442,8 +442,9 @@ static void export_marks(char *file)
 		deco++;
 	}
 
-	if (ferror(f) || fclose(f))
+	if (ferror(f))
 		error("Unable to write marks file %s.", file);
+  	fclose(f);
 }
 
 static void import_marks(char *input_file)
Next: Thomas Rast
Message 1 of 10 in “found a resource leak in file builtin-fast-export.c”
  1. Martin EttlJul 9, 2009
  2. Thomas RastJul 9, 2009
  3. Johannes SchindelinJul 9, 2009
  4. Thomas RastJul 9, 2009
  5. Andreas EricssonJul 9, 2009
  6. Johannes SchindelinJul 9, 2009
  7. Fix export_marks() error handling.Matthias Andree, Jul 9, 2009
  8. Stephen R. van den BergJul 11, 2009
  9. Matthias AndreeJul 13, 2009
  10. Matthias AndreeJul 9, 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.