diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-21 22:27:59 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-21 22:27:59 +0100 |
commit | 9c2bef9f407ab1e9fcd4afff430fee5d565b7e87 (patch) | |
tree | ddaf6e4f6f1efc97ff4d242ddf690afe4e712316 /memory.c | |
parent | ed1f63961c96db6491b607ce41ec01d53b4e64a0 (diff) |
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){ |