threads / patch / 7399

patchuse xmalloc in git.c and help.c

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

## tl;dr

One message between Mar 26, 2007 and Mar 26, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

James Bowes· Mar 26, 2007, 00:39 UTC · lore
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
---
 git.c  |    2 +-
 help.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Show changes to 2 files +2 −2

git.c, help.c

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

← back to recent threads