[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
@ -143,7 +143,7 @@ int add_cache_entry(struct cache_entry *ce, int ok_to_add)
|
||||
/* Make sure the array is big enough .. */
|
||||
if (active_nr == active_alloc) {
|
||||
active_alloc = alloc_nr(active_alloc);
|
||||
active_cache = realloc(active_cache, active_alloc * sizeof(struct cache_entry *));
|
||||
active_cache = xrealloc(active_cache, active_alloc * sizeof(struct cache_entry *));
|
||||
}
|
||||
|
||||
/* Add it in.. */
|
||||
|
||||
Reference in New Issue
Block a user