Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
t/t6015-rev-list-show-all-parents.sh: use the $( ... ) construct for command substitution
[gitweb.git]
/
compat
/
nedmalloc
/
nedmalloc.c
diff --git
a/compat/nedmalloc/nedmalloc.c
b/compat/nedmalloc/nedmalloc.c
index 609ebba1258eac47983f2b9da5d582a5d5af5482..a0a16eb1bbfb22c13f29c15d2fd68ccc9c7e01ad 100644
(file)
--- a/
compat/nedmalloc/nedmalloc.c
+++ b/
compat/nedmalloc/nedmalloc.c
@@
-957,8
+957,9
@@
char *strdup(const char *s1)
{
char *s2 = 0;
if (s1) {
- s2 = malloc(strlen(s1) + 1);
- strcpy(s2, s1);
+ size_t len = strlen(s1) + 1;
+ s2 = malloc(len);
+ memcpy(s2, s1, len);
}
return s2;
}