From 2b087cb45ae91f90492a935625570d7d42ee3ecb Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 7 Apr 2010 14:26:15 -0400 Subject: New dmnsn_malloc() function, and friends. I'm tired of checking for malloc failures everywhere, considering it never happens. So just bail out whenever it does. A lot of stuff is guaranteed to succeed if it returns now. --- libdimension/error.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libdimension/error.c') diff --git a/libdimension/error.c b/libdimension/error.c index 118dd54..222f5eb 100644 --- a/libdimension/error.c +++ b/libdimension/error.c @@ -153,8 +153,9 @@ dmnsn_default_fatal_error_fn() if (pid == tid) { exit(EXIT_FAILURE); } else { - int *ret = malloc(sizeof(int)); - *ret = 1; + int *ret = malloc(sizeof(int)); /* Don't use dmnsn_malloc */ + if (ret) + *ret = 1; pthread_exit(ret); } #else -- cgit v1.2.3