diff options
Diffstat (limited to 'src/common/mem.c')
-rw-r--r-- | src/common/mem.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/mem.c b/src/common/mem.c new file mode 100644 index 0000000..855e010 --- /dev/null +++ b/src/common/mem.c | |||
@@ -0,0 +1,12 @@ | |||
1 | #include "common/mem.h" | ||
2 | #include <stdlib.h> | ||
3 | #include "common/error.h" | ||
4 | |||
5 | void *malloc_or_die(size_t size) { | ||
6 | void *ptr = malloc(size); | ||
7 | |||
8 | if (ptr == NULL) | ||
9 | rage_quit(OUT_OF_MEMORY_ERROR); | ||
10 | |||
11 | return ptr; | ||
12 | } | ||