Use xmalloc() and friends to catch allocation failures

Some places use the standard malloc/strdup without checking if the
allocation was successful; they should use xmalloc/xstrdup that
check the memory allocation result.

Signed-off-by: Dotan Barak <dotanba@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Dotan Barak
2008-09-09 21:57:10 +03:00
committed by Junio C Hamano
parent 4886b89f8f
commit e8eec71d6e
5 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)
}
url = argv[arg];
if (url && url[strlen(url)-1] != '/') {
rewritten_url = malloc(strlen(url)+2);
rewritten_url = xmalloc(strlen(url)+2);
strcpy(rewritten_url, url);
strcat(rewritten_url, "/");
url = rewritten_url;