Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-21 11:58:18 +0300
committerJunio C Hamano <junkio@cox.net>2007-02-21 12:14:34 +0300
commit6c912f5b04e3216a5487e03235a8454b754a464e (patch)
tree57b60fea8e5052936cb7a92a0c51b5126dbd68d8 /builtin-apply.c
parentc24e9757e9f608ad3985ee9093d28ca5cd37f052 (diff)
Fix botched "leak fix"
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>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 2a40af3ff0..1beebe5ff1 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2516,9 +2516,15 @@ static void prefix_patches(struct patch *p)
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);
+ }
}
}