aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
new file mode 100644
index 0000000..d34b722
--- /dev/null
+++ b/src/util.c
@@ -0,0 +1,11 @@
+#include <stdlib.h>
+
+void *
+must_malloc(size_t size)
+{
+ void *ret = malloc(size);
+ if (ret == NULL) {
+ fprintf(stderr, "out of memory\n");
+ exit(EXIT_ABNORMAL);
+ }
+}