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

[PATCH] Fix minor memory leak in init-db

From
Ammon Riley <ammon.riley@gmail.com>
Date
May 14, 2009, 22:22 UTC
Message-ID
<cd3664ac0905141522s3ad78411o9f015d2e7720c8b5@mail.gmail.com>

There was an xmalloc() for path, but I didn't see a corresponding free(). Does it happen somewhere else that I'm not expecting?

Signed-off-by: Ammon Riley <ammon.riley@gmail.com>
---
 builtin-init-db.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index d1fa12a..6969987 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -308,6 +308,8 @@ int init_db(const char *template_dir, unsigned int flags)
 	strcpy(path+len, "/info");
 	safe_create_dir(path, 1);

+	free(path);
+
 	if (shared_repository) {
 		char buf[10];
 		/* We do not spell "group" and such, so that
-- 
1.6.3.1.9.g95405b.dirty
Next: Junio C Hamano
Message 1 of 5 in “Fix minor memory leak in init-db”
  1. Fix minor memory leak in init-dbAmmon Riley, May 14, 2009
  2. Junio C HamanoMay 16, 2009
  3. Ammon RileyMay 17, 2009
  4. Junio C HamanoMay 17, 2009
  5. Ammon RileyMay 17, 2009

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.