summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index 6f8253f..1afa475 100644
--- a/memory.c
+++ b/memory.c
@@ -1,6 +1,14 @@
#include <stdio.h>
#include "memory.h"
+#undef memdup
+
+void* memdup(void *buf, size_t num){
+ if(buf == NULL) return NULL;
+ char *buf2 = malloc(num, char);
+ memcpy(buf2, buf, num);
+ return (void*)buf2;
+}
void* check_after_allocation(const char *funcname, void *ptr){
if(ptr == NULL){