aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/mem.c')
-rw-r--r--src/utils/mem.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/mem.c b/src/utils/mem.c
index 7befc73..7c5e0a2 100644
--- a/src/utils/mem.c
+++ b/src/utils/mem.c
@@ -26,3 +26,17 @@ b_malloc(size_t size)
}
return rv;
}
+
+
+void*
+b_realloc(void *ptr, size_t size)
+{
+ // simple things even simpler :P
+ void *rv = realloc(ptr, size);
+ if (rv == NULL && size != 0) {
+ fprintf(stderr, "fatal error: Failed to reallocate memory!\n");
+ free(ptr);
+ exit(1);
+ }
+ return rv;
+}