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

[PATCH v2 1/3] ref-filter: free memory from used_atom

From
Olga Telezhnaya <olyatelezhnaya@gmail.com>
Date
Oct 18, 2018, 07:28 UTC
Message-ID
<010201668613c3de-23d41696-1476-4949-9834-a31adeb0650e-000000@eu-west-1.amazonses.com>
In-Reply-To
<0102016657e7cfee-f1343b1e-9a85-4cae-990a-cc7177ea8487-000000@eu-west-1.amazonses.com>

Release memory from used_atom variable for reducing number of memory leaks.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
---
 ref-filter.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/ref-filter.c b/ref-filter.c
index e1bcb4ca8a197..70f1d13ab3beb 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1996,6 +1996,10 @@ void ref_array_clear(struct ref_array *array)
 {
 	int i;
 
+	for (i = 0; i < used_atom_cnt; i++)
+		free((char *)used_atom[i].name);
+	FREE_AND_NULL(used_atom);
+	used_atom_cnt = 0;
 	for (i = 0; i < array->nr; i++)
 		free_array_item(array->items[i]);
 	FREE_AND_NULL(array->items);

--
https://github.com/git/git/pull/538
Next: Olga Telezhnaya
Message 1 of 3 in “ref-filter: free memory from used_atom”
  1. 1/3 ref-filter: free memory from used_atomOlga Telezhnaya, Oct 18, 2018
  2. 2/3 ls-remote: release memory instead of UNLEAKOlga Telezhnaya, Oct 18, 2018
  3. 3/3 ref-filter: free item->value and item->value->sOlga Telezhnaya, Oct 18, 2018

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.