summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c24e975)
raw | patch | inline | side by side (parent: c24e975)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 21 Feb 2007 08:58:18 +0000 (00:58 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 21 Feb 2007 09:14:34 +0000 (01:14 -0800) |
When (new_name == old_name), the previous one prefixed old_name
alone, leaving new_name untouched, and worse yet, left it
dangling pointing at an already freed memory location.
Signed-off-by: Junio C Hamano <junkio@cox.net>
alone, leaving new_name untouched, and worse yet, left it
dangling pointing at an already freed memory location.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-apply.c | patch | blob | history |
diff --git a/builtin-apply.c b/builtin-apply.c
index 2a40af3ff042c840aa7ca10a76d29a015ca6a73b..1beebe5ff1d50ffaba040801d04a9c7dcd77d1d5 100644 (file)
--- a/builtin-apply.c
+++ b/builtin-apply.c
if (!prefix)
return;
for ( ; p; p = p->next) {
- if (p->new_name != p->old_name)
+ if (p->new_name == p->old_name) {
+ char *prefixed = p->new_name;
+ prefix_one(&prefixed);
+ p->new_name = p->old_name = prefixed;
+ }
+ else {
prefix_one(&p->new_name);
- prefix_one(&p->old_name);
+ prefix_one(&p->old_name);
+ }
}
}