Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2009-06-14 23:46:10 +0400
committerJunio C Hamano <gitster@pobox.com>2009-06-15 00:35:40 +0400
commitce61595ea7eb3df22f6a943a38a273141f1af978 (patch)
tree558ef88b7c91c7d663b442469ea60e46808044bd
parent4a4b4cdaabde477514c4938b60961538e1d2d91f (diff)
avoid NULL dereference on failed malloc
* builtin-remote.c (get_one_entry): Use xmalloc, not malloc. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-remote.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 3f6f5c2318..fd0e63c5dc 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -1285,7 +1285,7 @@ static int get_one_entry(struct remote *remote, void *priv)
if (remote->url_nr > 0) {
utilp = &(string_list_append(remote->name, list)->util);
- *utilp = malloc(strlen(remote->url[0])+strlen(" (fetch)")+1);
+ *utilp = xmalloc(strlen(remote->url[0])+strlen(" (fetch)")+1);
strcpy((char *) *utilp, remote->url[0]);
strcat((char *) *utilp, " (fetch)");
} else
@@ -1300,7 +1300,7 @@ static int get_one_entry(struct remote *remote, void *priv)
for (i = 0; i < url_nr; i++)
{
utilp = &(string_list_append(remote->name, list)->util);
- *utilp = malloc(strlen(url[i])+strlen(" (push)")+1);
+ *utilp = xmalloc(strlen(url[i])+strlen(" (push)")+1);
strcpy((char *) *utilp, url[i]);
strcat((char *) *utilp, " (push)");
}