summaryrefslogtreecommitdiffstats
path: root/lib/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index eeec137c9e..ceced7f48e 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -725,3 +725,17 @@ void *memchr_inv(const void *start, int c, size_t bytes)
return check_bytes8(start, value, bytes % 8);
}
EXPORT_SYMBOL(memchr_inv);
+
+void *memdup(const void *orig, size_t size)
+{
+ void *buf;
+
+ buf = malloc(size);
+ if (!buf)
+ return NULL;
+
+ memcpy(buf, orig, size);
+
+ return buf;
+}
+EXPORT_SYMBOL(memdup);