aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-31 23:05:35 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-31 23:05:49 +0200
commit1f895a6ac8aa52d5a5d1b07257b27b62bfca86bb (patch)
treeeddabc6695af999cb6bc48d259a773a53db0867f /src
parentadd _LIBRARY_HEADER (diff)
downloadslibc-1f895a6ac8aa52d5a5d1b07257b27b62bfca86bb.tar.gz
slibc-1f895a6ac8aa52d5a5d1b07257b27b62bfca86bb.tar.bz2
slibc-1f895a6ac8aa52d5a5d1b07257b27b62bfca86bb.tar.xz
fix strdup functions
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/string/strdup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/string/strdup.c b/src/string/strdup.c
index 27783b9..c65970e 100644
--- a/src/string/strdup.c
+++ b/src/string/strdup.c
@@ -33,7 +33,7 @@ char* strdup(const char* string)
{
size_t n = strlen(string) + 1;
char* r = malloc(n * sizeof(char));
- return r == NULL ? NULL : memcpy(r, string, n);
+ return r == NULL ? NULL : memcpy(r, string, n * sizeof(char));
}
@@ -55,7 +55,7 @@ char* strndup(const char* string, size_t maxlen)
{
size_t n = strnlen(string, maxlen) + 1;
char* r = malloc(n * sizeof(char));
- return r == NULL ? NULL : memcpy(r, string, n);
+ return r == NULL ? NULL : memcpy(r, string, n * sizeof(char));
}
@@ -73,7 +73,7 @@ char* strndup(const char* string, size_t maxlen)
*/
void* memdup(const void* segment, size_t size)
{
- wchar_t* r = malloc(size * sizeof(wchar_t));
+ void* r = malloc(size);
return r == NULL ? NULL : memcpy(r, segment, size);
}