blob: ecfd43a9b24ef3c49c0a4586c3512c02cd640b28 [file] [log] [blame]
Arnaldo Carvalho de Melo4ddd3272015-11-16 11:36:29 -03001#include <stdlib.h>
2#include <string.h>
3#include <linux/string.h>
4
5/**
6 * memdup - duplicate region of memory
7 *
8 * @src: memory region to duplicate
9 * @len: memory region length
10 */
11void *memdup(const void *src, size_t len)
12{
13 void *p = malloc(len);
14
15 if (p)
16 memcpy(p, src, len);
17
18 return p;
19}