xref: /optee_os/lib/libutils/ext/nex_strdup.c (revision 32b3180828fa15a49ccc86ecb4be9d274c140c89)
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2018 EPAM Systems
4  */
5 #include <stdlib.h>
6 #include <string.h>
7 #include <string_ext.h>
8 
9 char *nex_strdup(const char *s)
10 {
11 	size_t l = strlen(s) + 1;
12 	char *p = nex_malloc(l);
13 
14 	if (p)
15 		memcpy(p, s, l);
16 	return p;
17 }
18