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

[PATCH 3/4] Plug memory leak in sha1close()

From
Sergey Vlasov <vsu@altlinux.ru>
Date
Aug 8, 2005, 18:46 UTC
Message-ID
<20050808184613.GD5789@procyon.home>
In-Reply-To
<20050808184332.GA5789@procyon.home>
[PATCH] Plug memory leak in sha1close()

sha1create() and sha1fd() malloc the returned struct sha1file; sha1close() should free it.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
---
 csum-file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
2207ae4977cbaa84636487ca24bad9d1116f54e0
diff --git a/csum-file.c b/csum-file.c
--- a/csum-file.c
+++ b/csum-file.c
@@ -45,6 +45,7 @@ int sha1close(struct sha1file *f, unsign
 		sha1flush(f, 20);
 	if (close(f->fd))
 		die("%s: sha1 file error on close (%s)", f->name, strerror(errno));
+	free(f);
 	return 0;
 }
 
Previous: Sergey VlasovNext: Sergey Vlasov
Message 4 of 5 in “Plug some more memory leaks in git”
  1. 0/4 Plug some more memory leaks in gitSergey Vlasov, Aug 8, 2005
  2. 1/4 Plug memory leak in read_object_with_reference()Sergey Vlasov, Aug 8, 2005
  3. 2/4 Plug memory leak in write_sha1_to_fd()Sergey Vlasov, Aug 8, 2005
  4. 3/4 Plug memory leak in sha1close()Sergey Vlasov, Aug 8, 2005
  5. 4/4 Plug memory leak in git-pack-objectsSergey Vlasov, Aug 8, 2005

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.