[PATCH] introduce xmalloc and xrealloc
Introduce xmalloc and xrealloc to die gracefully with a descriptive message when out of memory, rather than taking a SIGSEGV. Signed-off-by: Christopher Li<chrislgit@chrisli.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:

committed by
Linus Torvalds

parent
f2a19340ad
commit
812666c8e6
@ -73,7 +73,7 @@ static int fetch(unsigned char *sha1)
|
||||
curl_easy_setopt(curl, CURLOPT_FILE, NULL);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
|
||||
|
||||
url = malloc(strlen(base) + 50);
|
||||
url = xmalloc(strlen(base) + 50);
|
||||
strcpy(url, base);
|
||||
posn = url + strlen(base);
|
||||
strcpy(posn, "objects/");
|
||||
|
Reference in New Issue
Block a user