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

[PATCH] Fix memory leak in prepend_to_path (git.c).

From
Christian Couder <chriscool@tuxfamily.org>
Date
Sep 5, 2006, 06:22 UTC
Message-ID
<20060905082216.c9b11769.chriscool@tuxfamily.org>

Some memory was allocated for a new path but not freed after the path was used.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 git.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git.c b/git.c
index 1d00111..335f405 100644
--- a/git.c
+++ b/git.c
@@ -36,6 +36,8 @@ static void prepend_to_path(const char *
 	memcpy(path + len + 1, old_path, path_len - len);
 
 	setenv("PATH", path, 1);
+
+	free(path);
 }
 
 static int handle_options(const char*** argv, int* argc)
-- 
1.4.2.g269a-dirty
Message 1 of 1 in “Fix memory leak in prepend_to_path (git.c).”
  1. Fix memory leak in prepend_to_path (git.c).Christian Couder, Sep 5, 2006

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.