summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 040a655)
raw | patch | inline | side by side (parent: 040a655)
author | Brandon Casey <drafnel@gmail.com> | |
Thu, 6 Oct 2011 18:22:23 +0000 (13:22 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 6 Oct 2011 20:54:32 +0000 (13:54 -0700) |
The "it" string would not be free'ed if base_name was non-NULL.
Let's free it.
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Let's free it.
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/mv.c | patch | blob | history |
diff --git a/builtin/mv.c b/builtin/mv.c
index e9d191f0562df86d9a19311704cb5fc77e9b8caf..5efe6c5760c43d0059a940ab9d4610b97092c8bd 100644 (file)
--- a/builtin/mv.c
+++ b/builtin/mv.c
to_copy--;
if (to_copy != length || base_name) {
char *it = xmemdupz(result[i], to_copy);
- result[i] = base_name ? xstrdup(basename(it)) : it;
+ if (base_name) {
+ result[i] = xstrdup(basename(it));
+ free(it);
+ } else
+ result[i] = it;
}
}
return get_pathspec(prefix, result);