X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-mv.c;h=b9446516915c998e41e645a7cc3e28c25ee21dc1;hb=182af8343c307436bb5364309aa6d4d46fa5911d;hp=b95b7d286ab5358a89a0309927b9f5e5e23fc4d0;hpb=89df580d0a2e97b0c7c072d87e5e815534deed56;p=git.git diff --git a/builtin-mv.c b/builtin-mv.c index b95b7d286..b94465169 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -22,10 +22,7 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec, for (i = 0; i < count; i++) { int length = strlen(result[i]); if (length > 0 && result[i][length - 1] == '/') { - char *without_slash = xmalloc(length); - memcpy(without_slash, result[i], length - 1); - without_slash[length - 1] = '\0'; - result[i] = without_slash; + result[i] = xmemdupz(result[i], length - 1); } if (base_name) { const char *last_slash = strrchr(result[i], '/');