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

[PATCH] builtin-clone.c: no need to strdup for setenv

From
ARAli Gholami Rudi <ali@rudi.ir>
Date
Apr 1, 2009, 11:22 UTC
Message-ID
<20090401112225.GB2237@lilem.mirepesht>
The setenv function makes a copy, itself.
Signed-off-by: Ali Gholami Rudi <ali@rudi.ir>
---
 builtin-clone.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index 0031b5f..28d15bb 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -406,7 +406,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	atexit(remove_junk);
 	sigchain_push_common(remove_junk_on_signal);
 
-	setenv(CONFIG_ENVIRONMENT, xstrdup(mkpath("%s/config", git_dir)), 1);
+	setenv(CONFIG_ENVIRONMENT, mkpath("%s/config", git_dir), 1);
 
 	if (safe_create_leading_directories_const(git_dir) < 0)
 		die("could not create leading directories of '%s'", git_dir);
Message 1 of 1 in “builtin-clone.c: no need to strdup for setenv”
  1. builtin-clone.c: no need to strdup for setenvAli Gholami Rudi, Apr 1, 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.