summaryrefslogtreecommitdiffstats
path: root/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/malloc.c b/malloc.c
new file mode 100644
index 0000000..080eb2f
--- /dev/null
+++ b/malloc.c
@@ -0,0 +1,13 @@
+#include <string.h>
+
+#include "malloc.h"
+
+void* sa_memdup(const void* p, size_t size) {
+ void *r;
+
+ if (!(r = malloc(size)))
+ return NULL;
+
+ memcpy(r, p, size);
+ return r;
+}