diff options
Diffstat (limited to 'memory.c')
-rw-r--r-- | memory.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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){ |