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

[PATCH] commit: free the right buffer in release_commit_memory

From
Mike Hommey <mh@glandium.org>
Date
Aug 26, 2019, 02:01 UTC
Message-ID
<20190826020137.4703-1-mh@glandium.org>

The index field in the commit object is used to find the buffer corresponding to that commit in the buffer_slab. Resetting it first means free_commit_buffer is not going to free the right buffer.

Signed-off-by: Mike Hommey <mh@glandium.org>
---
 commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commit.c b/commit.c
index a98de16e3d..3fe5f8fa9c 100644
--- a/commit.c
+++ b/commit.c
@@ -364,8 +364,8 @@ struct object_id *get_commit_tree_oid(const struct commit *commit)
 void release_commit_memory(struct parsed_object_pool *pool, struct commit *c)
 {
 	set_commit_tree(c, NULL);
-	c->index = 0;
 	free_commit_buffer(pool, c);
+	c->index = 0;
 	free_commit_list(c->parents);
 
 	c->object.parsed = 0;
-- 
2.23.0
Next: Junio C Hamano
Message 1 of 2 in “commit: free the right buffer in release_commit_memory”
  1. commit: free the right buffer in release_commit_memoryMike Hommey, Aug 26, 2019
  2. Junio C HamanoAug 26, 2019

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.