[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:
Christopher Li
2005-04-26 12:00:58 -07:00
committed by Linus Torvalds
parent f2a19340ad
commit 812666c8e6
18 changed files with 54 additions and 41 deletions

View File

@ -34,7 +34,7 @@ int main(int argc, char **argv)
fprintf(stderr, "defaulting to local storage area\n");
}
len = strlen(sha1_dir);
path = malloc(len + 40);
path = xmalloc(len + 40);
memcpy(path, sha1_dir, len);
safe_create_dir(sha1_dir);