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

[PATCH] ref-filter.c: fix a leak in get_head_description

From
Rubén Justo <rjusto@gmail.com>
Date
Sep 24, 2022, 22:53 UTC
Message-ID
<6ff29e96-7f8d-c354-dced-b1b363e54467@gmail.com>

In 2708ce62d2 (branch: sort detached HEAD based on a flag, 2021-01-07) a call to wt_status_state_free_buffers, responsible of freeing the resources that could be allocated in the local struct wt_status_state state, was eliminated.

The call to wt_status_state_free_buffers was introduced in 962dd7ebc3 (wt-status: introduce wt_status_state_free_buffers(), 2020-09-27). This commit brings back that call in get_head_description.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
---
 ref-filter.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/ref-filter.c b/ref-filter.c
index fd1cb14b0f..914908fac5 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1722,6 +1722,8 @@ char *get_head_description(void)
 	} else
 		strbuf_addstr(&desc, _("(no branch)"));
 
+	wt_status_state_free_buffers(&state);
+
 	return strbuf_detach(&desc, NULL);
 }
 
-- 
2.36.1
Next: Martin Ågren
Message 1 of 7 in “ref-filter.c: fix a leak in get_head_description”
  1. ref-filter.c: fix a leak in get_head_descriptionRubén Justo, Sep 24, 2022
  2. Martin ÅgrenSep 26, 2022
  3. Junio C HamanoSep 26, 2022
  4. Martin ÅgrenSep 27, 2022
  5. Ævar Arnfjörð BjarmasonSep 26, 2022
  6. Rubén JustoSep 26, 2022
  7. Rubén JustoOct 8, 2022

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.