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

[PATCH] builtin/log.c: fix minor memory leak

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Aug 7, 2014, 17:13 UTC
Message-ID
<1407431617-4156-1-git-send-email-Matthieu.Moy@imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Valgrind confirms, one less unreachable block ;-).
 builtin/log.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/builtin/log.c b/builtin/log.c
index 4389722..e4d8122 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -857,20 +857,21 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name)
 {
 	struct strbuf desc = STRBUF_INIT;
 	if (!branch_name || !*branch_name)
 		return;
 	read_branch_desc(&desc, branch_name);
 	if (desc.len) {
 		strbuf_addch(buf, '\n');
 		strbuf_addbuf(buf, &desc);
 		strbuf_addch(buf, '\n');
 	}
+	strbuf_release(&desc);
 }
 
 static char *find_branch_name(struct rev_info *rev)
 {
 	int i, positive = -1;
 	unsigned char branch_sha1[20];
 	const unsigned char *tip_sha1;
 	const char *ref, *v;
 	char *full_ref, *branch = NULL;
 
-- 
2.0.2.737.gfb43bde
Next: Jonathan Nieder
Message 1 of 3 in “builtin/log.c: fix minor memory leak”
  1. builtin/log.c: fix minor memory leakMatthieu Moy, Aug 7, 2014
  2. Jonathan NiederAug 7, 2014
  3. Junio C HamanoAug 7, 2014

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.