summaryrefslogtreecommitdiffstats
path: root/libdimension/error.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-07 14:26:15 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-07 14:34:52 -0400
commit2b087cb45ae91f90492a935625570d7d42ee3ecb (patch)
treea464213b08d04c8c91c8879a84e534f895c84378 /libdimension/error.c
parent7d6663eeb68bf9d0a3dff86128827c0c1d85df69 (diff)
downloaddimension-2b087cb45ae91f90492a935625570d7d42ee3ecb.tar.xz
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.
Diffstat (limited to 'libdimension/error.c')
-rw-r--r--libdimension/error.c5
1 files changed, 3 insertions, 2 deletions
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