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

[PATCH v2 03/12] download_https_uri_to_file(): do not leak fd upon failure

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 5, 2026, 08:24 UTC
Message-ID
<17c3b4ce4f0051bf0c27ae157c25af97275ba742.1783239870.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.2163.v2.git.1783239870.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

When the `git-remote-https` command fails, we do not want to leak `child_out`.

Pointed out by Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 bundle-uri.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bundle-uri.c b/bundle-uri.c
index 3b2e347288..34fa452e76 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -378,7 +378,7 @@ cleanup:
 	if (child_in)
 		fclose(child_in);
 	if (finish_command(&cp))
-		return 1;
+		result = 1;
 	if (child_out)
 		fclose(child_out);
 	return result;
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 32 of 44 in “coverity: fix leaks and error paths”
  1. 00/13 coverity: fix leaks and error pathsJohannes Schindelin via GitGitGadget, Jul 1, 2026
  2. 01/13 load_one_loose_object_map(): fix resource leakJohannes Schindelin via GitGitGadget, Jul 1, 2026
  3. Patrick SteinhardtJul 1, 2026
  4. Junio C HamanoJul 1, 2026
  5. Johannes SchindelinJul 4, 2026
  6. 02/13 loose: avoid closing invalid fd on error pathJohannes Schindelin via GitGitGadget, Jul 1, 2026
  7. Patrick SteinhardtJul 1, 2026
  8. 03/13 download_https_uri_to_file(): do not leak fd upon failureJohannes Schindelin via GitGitGadget, Jul 1, 2026
  9. 04/13 run-command: avoid close(-1) in start_command() error pathsJohannes Schindelin via GitGitGadget, Jul 1, 2026
  10. Patrick SteinhardtJul 1, 2026
  11. 05/13 run_diff_files: avoid memory leakJohannes Schindelin via GitGitGadget, Jul 1, 2026
  12. Patrick SteinhardtJul 1, 2026
  13. Johannes SchindelinJul 4, 2026
  14. 06/13 line-log: avoid redundant copy that leaks in process_rangesJohannes Schindelin via GitGitGadget, Jul 1, 2026
  15. Jeff KingJul 1, 2026
  16. 07/13 dir: free allocations on parse-error paths in read_one_dir()Johannes Schindelin via GitGitGadget, Jul 1, 2026
  17. Patrick SteinhardtJul 1, 2026
  18. Johannes SchindelinJul 4, 2026
  19. 08/13 submodule: fix cwd leak in get_superproject_working_tree()Johannes Schindelin via GitGitGadget, Jul 1, 2026
  20. Patrick SteinhardtJul 1, 2026
  21. Johannes SchindelinJul 4, 2026
  22. 09/13 worktree: fix resource leaks when branch creation failsJohannes Schindelin via GitGitGadget, Jul 1, 2026
  23. 10/13 imap-send: avoid leaking the IMAP upload bufferJohannes Schindelin via GitGitGadget, Jul 1, 2026
  24. 11/13 reftable/table: release filter on error pathJohannes Schindelin via GitGitGadget, Jul 1, 2026
  25. 12/13 fsmonitor: plug token-data leak on early daemon-startup failuresJohannes Schindelin via GitGitGadget, Jul 1, 2026
  26. 13/13 mingw: make exit_process() own the process handle on all pathsJohannes Schindelin via GitGitGadget, Jul 1, 2026
  27. Junio C HamanoJul 1, 2026
  28. 00/12 coverity: fix leaks and error pathsJohannes Schindelin via GitGitGadget, Jul 5, 2026
  29. 01/12 load_one_loose_object_map(): fix resource leakJohannes Schindelin via GitGitGadget, Jul 5, 2026
  30. Patrick SteinhardtJul 7, 2026
  31. 02/12 loose: avoid closing invalid fd on error pathJohannes Schindelin via GitGitGadget, Jul 5, 2026
  32. 03/12 download_https_uri_to_file(): do not leak fd upon failureJohannes Schindelin via GitGitGadget, Jul 5, 2026
  33. 04/12 run-command: avoid `close(-1)` in `start_command()` error pathsJohannes Schindelin via GitGitGadget, Jul 5, 2026
  34. 05/12 line-log: avoid redundant copy that leaks in process_rangesJohannes Schindelin via GitGitGadget, Jul 5, 2026
  35. 06/12 dir: free allocations on parse-error paths in `read_one_dir()`Johannes Schindelin via GitGitGadget, Jul 5, 2026
  36. 07/12 submodule: fix cwd leak in `get_superproject_working_tree()`Johannes Schindelin via GitGitGadget, Jul 5, 2026
  37. Patrick SteinhardtJul 7, 2026
  38. 08/12 worktree: fix resource leaks when branch creation failsJohannes Schindelin via GitGitGadget, Jul 5, 2026
  39. 09/12 imap-send: avoid leaking the IMAP upload bufferJohannes Schindelin via GitGitGadget, Jul 5, 2026
  40. 10/12 reftable/table: release filter on error pathJohannes Schindelin via GitGitGadget, Jul 5, 2026
  41. 11/12 fsmonitor: plug token-data leak on early daemon-startup failuresJohannes Schindelin via GitGitGadget, Jul 5, 2026
  42. 12/12 mingw: make `exit_process()` own the process handle on all pathsJohannes Schindelin via GitGitGadget, Jul 5, 2026
  43. Patrick SteinhardtJul 7, 2026
  44. Junio C HamanoJul 7, 2026

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.