aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-14 11:05:35 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-14 11:05:35 +0100
commit54064158d84fc4006e651deb314cde156cc383e8 (patch)
treea534f160fe02b593143e03aaaf52f65513352c90 /memory.c
Register working
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/memory.c b/memory.c
new file mode 100644
index 0000000..952bedf
--- /dev/null
+++ b/memory.c
@@ -0,0 +1,9 @@
+#include "global.h"
+#include "memory.h"
+
+void* check_after_allocation(const char *func,size_t num,size_t sz,void *ptr){
+ if(ptr==NULL){
+ die("Allocation failed: %s(%zu * %zuB = %zu)",func,num,sz,num*sz);
+ }
+ return ptr;
+}