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

[PATCH] use xmalloc in git.c and help.c

From
James Bowes <jbowes@dangerouslyinc.com>
Date
Mar 26, 2007, 00:39 UTC
Message-ID
<11748695762499-git-send-email-jbowes@dangerouslyinc.com>
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
---
 git.c  |    2 +-
 help.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git.c b/git.c
index ed1c65e..5b1bc2a 100644
--- a/git.c
+++ b/git.c
@@ -99,7 +99,7 @@ static int split_cmdline(char *cmdline, const char ***argv)
 	int src, dst, count = 0, size = 16;
 	char quoted = 0;
 
-	*argv = malloc(sizeof(char*) * size);
+	*argv = xmalloc(sizeof(char*) * size);
 
 	/* split alias_string */
 	(*argv)[count++] = cmdline;
diff --git a/help.c b/help.c
index 0893fea..be8651a 100644
--- a/help.c
+++ b/help.c
@@ -58,7 +58,7 @@ static void add_cmdname(const char *name, int len)
 		if (!cmdname)
 			oom();
 	}
-	ent = malloc(sizeof(*ent) + len);
+	ent = xmalloc(sizeof(*ent) + len);
 	if (!ent)
 		oom();
 	ent->len = len;
-- 
1.5.0.5
Message 1 of 1 in “use xmalloc in git.c and help.c”
  1. use xmalloc in git.c and help.cJames Bowes, Mar 26, 2007

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.