[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
@ -39,7 +39,7 @@ static int force = 0, quiet = 0, not_new = 0;
|
||||
static void create_directories(const char *path)
|
||||
{
|
||||
int len = strlen(path);
|
||||
char *buf = malloc(len + 1);
|
||||
char *buf = xmalloc(len + 1);
|
||||
const char *slash = path;
|
||||
|
||||
while ((slash = strchr(slash+1, '/')) != NULL) {
|
||||
|
Reference in New Issue
Block a user