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

[PATCH v2 1/7] clear_pattern_list(): clear embedded hashmaps

From
Jeff King <peff@peff.net>
Date
Aug 17, 2020, 21:33 UTC
Message-ID
<20200817213302.GA1854722@coredump.intra.peff.net>
In-Reply-To
<20200817213228.GA1854603@coredump.intra.peff.net>

Commit 96cc8ab531 (sparse-checkout: use hashmaps for cone patterns, 2019-11-21) added some auxiliary hashmaps to the pattern_list struct, but they're leaked when clear_pattern_list() is called.

Signed-off-by: Jeff King <peff@peff.net>
---
 dir.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/dir.c b/dir.c
index fe64be30ed..9411b94e9b 100644
--- a/dir.c
+++ b/dir.c
@@ -916,6 +916,8 @@ void clear_pattern_list(struct pattern_list *pl)
 		free(pl->patterns[i]);
 	free(pl->patterns);
 	free(pl->filebuf);
+	hashmap_free_entries(&pl->recursive_hashmap, struct pattern_entry, ent);
+	hashmap_free_entries(&pl->parent_hashmap, struct pattern_entry, ent);
 
 	memset(pl, 0, sizeof(*pl));
 }
-- 
2.28.0.605.g35fde94f44
Previous: Jeff KingNext: Jeff King
Message 14 of 20 in “more small leak fixes”
  1. 0/6 more small leak fixesJeff King, Aug 14, 2020
  2. 1/6 submodule--helper: use strbuf_release() to free strbufsJeff King, Aug 14, 2020
  3. 2/6 checkout: fix leak of non-existent branch namesJeff King, Aug 14, 2020
  4. 3/6 config: fix leaks from git_config_get_string_const()Jeff King, Aug 14, 2020
  5. 4/6 config: drop git_config_get_string_const()Jeff King, Aug 14, 2020
  6. Junio C HamanoAug 14, 2020
  7. Jeff KingAug 15, 2020
  8. Junio C HamanoAug 17, 2020
  9. 5/6 config: fix leak in git_config_get_expiry_in_days()Jeff King, Aug 14, 2020
  10. 6/6 submodule--helper: fix leak of core.worktree valueJeff King, Aug 14, 2020
  11. Jeff KingAug 14, 2020
  12. Jeff KingAug 14, 2020
  13. 0/7 leak fixesJeff King, Aug 17, 2020
  14. 1/7 clear_pattern_list(): clear embedded hashmapsJeff King, Aug 17, 2020
  15. 2/7 submodule--helper: use strbuf_release() to free strbufsJeff King, Aug 17, 2020
  16. 3/7 checkout: fix leak of non-existent branch namesJeff King, Aug 17, 2020
  17. 4/7 config: fix leaks from git_config_get_string_const()Jeff King, Aug 17, 2020
  18. 6/7 config: fix leak in git_config_get_expiry_in_days()Jeff King, Aug 17, 2020
  19. 7/7 submodule--helper: fix leak of core.worktree valueJeff King, Aug 17, 2020
  20. 5/7 config: drop git_config_get_string_const()Jeff King, Aug 17, 2020

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.